[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project

src/klftools/klfpixmapbutton.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfpixmapbutton.h
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2010 by Philippe Faist
00005  *   philippe.faist at bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id: klfpixmapbutton.h 442 2010-08-13 17:34:38Z philippe $ */
00023 
00024 #ifndef KLFPIXMAPBUTTON_H
00025 #define KLFPIXMAPBUTTON_H
00026 
00027 #include <QPushButton>
00028 #include <QPixmap>
00029 
00030 #include <klfdefs.h>
00031 
00033 class KLF_EXPORT KLFPixmapButton : public QPushButton
00034 {
00035   Q_OBJECT
00036 public:
00037   Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap USER true)
00038   Q_PROPERTY(int pixmapMargin READ pixmapMargin WRITE setPixmapMargin)
00039   Q_PROPERTY(float pixXAlignFactor READ pixXAlignFactor WRITE setPixXAlignFactor)
00040   Q_PROPERTY(float pixYAlignFactor READ pixYAlignFactor WRITE setPixYAlignFactor)
00041 
00042   KLFPixmapButton(const QPixmap& pix, QWidget *parent = 0);
00043   virtual ~KLFPixmapButton() { }
00044 
00045   virtual QSize minimumSizeHint() const;
00046   virtual QSize sizeHint() const;
00047 
00048   virtual QPixmap pixmap() const { return _pix; }
00049   virtual int pixmapMargin() const { return _pixmargin; }
00050   virtual float pixXAlignFactor() const { return _xalignfactor; }
00051   virtual float pixYAlignFactor() const { return _yalignfactor; }
00052 
00053 public slots:
00054   virtual void setPixmap(const QPixmap& pix) { _pix = pix; }
00055   virtual void setPixmapMargin(int pixels) { _pixmargin = pixels; }
00056   virtual void setPixXAlignFactor(float xalignfactor) { _xalignfactor = xalignfactor; }
00057   virtual void setPixYAlignFactor(float yalignfactor) { _yalignfactor = yalignfactor; }
00058 
00059 protected:
00060   virtual void paintEvent(QPaintEvent *event);
00061 
00062 private:
00063   QPixmap _pix;
00064   int _pixmargin;
00065   float _xalignfactor, _yalignfactor;
00066 };
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 #endif

Generated by doxygen 1.7.3