#ifndef TRANSLUCENTBUTTON_H
#define TRANSLUCENTBUTTON_H
-#include <QtGui>
+#include <QLabel>
#include <QString>
-class TranslucentButton: public QWidget
+class QWidget;
+class QPaintEvent;
+class QMouseEvent;
+class QTimer;
+
+/**
+ * A button that is transparent, but can temporarily be made opaque by
+ * flashing it.
+ */
+class TranslucentButton: public QLabel
{
Q_OBJECT
- Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
- explicit TranslucentButton(const QString &name, QWidget *parent);
- qreal opacity() const {return mOpacity;}
- void setOpacity(qreal opacity);
+ explicit TranslucentButton(const QString &iconName, QWidget *parent);
+ ~TranslucentButton();
+ static const int pixels;
+ static const int elevatorInterval;
public slots:
- void flash(int duration = 3000);
+ void flash(int duration = 700);
+ void stopFlash();
+
+signals:
+ void triggered();
protected:
- virtual void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *);
+ void mouseReleaseEvent(QMouseEvent *);
+ void timerEvent(QTimerEvent *e);
private:
QString name;
- qreal mOpacity;
+ bool transparent;
+ int elevatorTimer;
};
#endif // TRANSLUCENTBUTTON_H