3 #include "translucentbutton.h"
7 const int TranslucentButton::pixels = 95;
9 TranslucentButton::TranslucentButton(const QString &name_, QWidget *parent):
10 QLabel(parent), name(name_), transparent(true)
12 setGeometry(0, 0, pixels, pixels);
13 timer = new QTimer(this);
14 timer->setSingleShot(true);
15 connect(timer, SIGNAL(timeout()), this, SLOT(stopFlash()));
19 void TranslucentButton::paintEvent(QPaintEvent *)
21 QPainter painter(this);
23 painter.setRenderHint(QPainter::Antialiasing, true);
24 painter.drawPixmap(0, 0, QPixmap(Platform::icon(name)).scaled(
25 QSize(pixels, pixels), Qt::IgnoreAspectRatio,
26 Qt::SmoothTransformation));
28 painter.fillRect(0, 0, pixels, pixels, Qt::NoBrush);
32 void TranslucentButton::flash(int duration)
38 timer->start(duration);
41 void TranslucentButton::stopFlash()
47 void TranslucentButton::mouseReleaseEvent(QMouseEvent *e)