andre@722: #ifndef UI_TEXTOVERLAYBUTTON_H andre@722: #define UI_TEXTOVERLAYBUTTON_H andre@722: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik andre@722: * Software engineering by Intevation GmbH andre@722: * andre@722: * This file is Free Software under the GNU GPL (v>=2) andre@722: * and comes with ABSOLUTELY NO WARRANTY! andre@722: * See LICENSE.txt for details. andre@722: */ andre@722: andre@1255: /** emanuel@1053: * @file textoverlaybutton.h emanuel@1053: * @brief A tool button that overlays a text over the icon. emanuel@1053: */ andre@722: andre@722: #include andre@722: #include andre@932: #include andre@722: andre@722: class QPaintEvent; andre@722: andre@1255: /** @brief A tool button that overlays a text over the icon. andre@1255: */ andre@722: class TextOverlayButton : public QToolButton andre@722: { andre@722: Q_OBJECT andre@722: andre@722: public: andre@722: QString overlay() {return mOverlay;} andre@722: andre@722: protected: andre@722: virtual void paintEvent(QPaintEvent *); andre@722: andre@722: public slots: andre@722: void setOverlay (const QString& text) {mOverlay = text; repaint();} andre@932: void setBackgroundIcon (const QString& iconPath); andre@722: andre@722: private: andre@722: QString mOverlay; andre@932: QPixmap mBackground; andre@722: }; andre@722: andre@722: #endif // UI_TEXTOVERLAYBUTTON_H