Fix forward navigation control on Linux.
[dorian] / widgets / translucentbutton.h
1 #ifndef TRANSLUCENTBUTTON_H
2 #define TRANSLUCENTBUTTON_H
3
4 #include <QLabel>
5 #include <QString>
6
7 class QWidget;
8 class QPaintEvent;
9 class QMouseEvent;
10 class QTimer;
11
12 /**
13  * A button that is transparent, but can temporarily be made opaque by
14  * flashing it.
15  */
16 class TranslucentButton: public QLabel
17 {
18     Q_OBJECT
19
20 public:
21     explicit TranslucentButton(const QString &iconName, QWidget *parent);
22     ~TranslucentButton();
23     static const int pixels;
24     static const int elevatorInterval;
25
26 public slots:
27     void flash(int duration = 700);
28     void stopFlash();
29
30 signals:
31     void triggered();
32
33 protected:
34     void paintEvent(QPaintEvent *);
35     void mouseReleaseEvent(QMouseEvent *);
36     void timerEvent(QTimerEvent *e);
37
38 private:
39     QString name;
40     bool transparent;
41     int elevatorTimer;
42 };
43
44 #endif // TRANSLUCENTBUTTON_H