Mercurial > trustbridge
diff ui/textoverlaybutton.h @ 722:b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 02 Jul 2014 18:35:30 +0200 |
parents | |
children | 57371f2e8dae |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/textoverlaybutton.h Wed Jul 02 18:35:30 2014 +0200 @@ -0,0 +1,35 @@ +#ifndef UI_TEXTOVERLAYBUTTON_H +#define UI_TEXTOVERLAYBUTTON_H +/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=2) + * and comes with ABSOLUTELY NO WARRANTY! + * See LICENSE.txt for details. + */ + +/** @file A tool button that overlays a text over the icon */ + +#include <QToolButton> +#include <QString> + +class QPaintEvent; + +class TextOverlayButton : public QToolButton +{ + Q_OBJECT + +public: + QString overlay() {return mOverlay;} + +protected: + virtual void paintEvent(QPaintEvent *); + +public slots: + void setOverlay (const QString& text) {mOverlay = text; repaint();} + +private: + QString mOverlay; +}; + +#endif // UI_TEXTOVERLAYBUTTON_H