Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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 Q_PROPERTY(float pixmapScale READ pixmapScale WRITE setPixmapScale)
00042
00043 KLFPixmapButton(const QPixmap& pix, QWidget *parent = 0);
00044 virtual ~KLFPixmapButton() { }
00045
00046 virtual QSize minimumSizeHint() const;
00047 virtual QSize sizeHint() const;
00048
00049 virtual QPixmap pixmap() const { return _pix; }
00050 virtual int pixmapMargin() const { return _pixmargin; }
00051 virtual float pixXAlignFactor() const { return _xalignfactor; }
00052 virtual float pixYAlignFactor() const { return _yalignfactor; }
00053 virtual float pixmapScale() const { return _pixscale; }
00054
00055 public slots:
00056 virtual void setPixmap(const QPixmap& pix) { _pix = pix; }
00057 virtual void setPixmapMargin(int pixels) { _pixmargin = pixels; }
00058 virtual void setPixXAlignFactor(float xalignfactor) { _xalignfactor = xalignfactor; }
00059 virtual void setPixYAlignFactor(float yalignfactor) { _yalignfactor = yalignfactor; }
00060 virtual void setPixmapScale(float x) { _pixscale = x; }
00061
00062 protected:
00063 virtual void paintEvent(QPaintEvent *event);
00064
00065 private:
00066 QPixmap _pix;
00067 int _pixmargin;
00068 float _xalignfactor, _yalignfactor;
00069 float _pixscale;
00070 };
00071
00072
00073
00074
00075
00076
00077
00078 #endif