diff options
Diffstat (limited to 'weather/src/pixmapbutton.h')
| -rw-r--r-- | weather/src/pixmapbutton.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/weather/src/pixmapbutton.h b/weather/src/pixmapbutton.h new file mode 100644 index 0000000..60c95a3 --- /dev/null +++ b/weather/src/pixmapbutton.h @@ -0,0 +1,29 @@ +#ifndef PIXMAPBUTTON_H +#define PIXMAPBUTTON_H + +#include <QObject> +#include <QGraphicsPixmapItem> + +class PixmapButton: public QObject, public QGraphicsPixmapItem +{ + Q_OBJECT + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity); +public: + PixmapButton(qreal minSize, const QPixmap &pixmap, QGraphicsItem *parent = 0); + QRectF boundingRect() const; + QPainterPath shape() const; + +public slots: + void doHide() { hide(); } + +signals: + void clicked(); + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *event); + +private: + const qreal m_minSize; +}; + +#endif // PIXMAPBUTTON_H |
