TranslucentButton::TranslucentButton(const QString &name_, QWidget *parent):
QLabel(parent), name(name_), transparent(true)
{
- setGeometry(0, 0, pixels, pixels);
- timer = new QTimer(this);
- timer->setSingleShot(true);
- connect(timer, SIGNAL(timeout()), this, SLOT(stopFlash()));
+ setFixedSize(pixels, pixels);
elevatorTimer = startTimer(elevatorInterval);
}
QPainter painter(this);
if (!transparent) {
painter.setRenderHint(QPainter::Antialiasing, true);
- painter.drawPixmap(0, 0, QPixmap(Platform::icon(name)).scaled(
+ painter.drawPixmap(0, 0, QPixmap(Platform::instance()->icon(name)).scaled(
QSize(pixels, pixels), Qt::IgnoreAspectRatio,
Qt::SmoothTransformation));
} else {
void TranslucentButton::flash(int duration)
{
- show();
raise();
+ show();
transparent = false;
update();
- timer->start(duration);
+ QTimer::singleShot(duration, this, SLOT(stopFlash()));
}
void TranslucentButton::stopFlash()
if (e->timerId() == elevatorTimer) {
raise();
}
+ QLabel::timerEvent(e);
}