3 #include "translucentbutton.h"
6 const int TranslucentButton::pixels = 95;
8 TranslucentButton::TranslucentButton(const QString &name_, QWidget *parent):
9 QLabel(parent), name(name_), transparent(true)
11 setGeometry(0, 0, pixels, pixels);
12 timer = new QTimer(this);
13 timer->setSingleShot(true);
14 connect(timer, SIGNAL(timeout()), this, SLOT(stopFlash()));
18 void TranslucentButton::paintEvent(QPaintEvent *)
20 QPainter painter(this);
22 painter.setRenderHint(QPainter::Antialiasing, true);
23 painter.drawPixmap(0, 0, QPixmap(Platform::icon(name)).scaled(
24 QSize(pixels, pixels), Qt::IgnoreAspectRatio,
25 Qt::SmoothTransformation));
27 painter.fillRect(0, 0, pixels, pixels, Qt::NoBrush);
31 void TranslucentButton::flash(int duration)
37 timer->start(duration);
40 void TranslucentButton::stopFlash()
46 void TranslucentButton::mouseReleaseEvent(QMouseEvent *e)