removed unneeded animation in NotificationsLabelWidget

This commit is contained in:
Luis Ángel San Martín 2016-01-13 22:02:15 +01:00
parent 97c788203c
commit 09e8062a9a
2 changed files with 4 additions and 19 deletions

View File

@ -11,25 +11,15 @@ NotificationsLabelWidget::NotificationsLabelWidget(QWidget * parent)
setAttribute(Qt::WA_LayoutUsesWidgetRect,true); setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
effect = new QGraphicsOpacityEffect(this); effect = new QGraphicsOpacityEffect(this);
effect->setOpacity(1.0); effect->setOpacity(1.0);
effect2= new QGraphicsOpacityEffect(this);
effect->setOpacity(1.0);
anim = new QPropertyAnimation(effect,"opacity"); anim = new QPropertyAnimation(effect,"opacity");
anim->setDuration(500); anim->setDuration(500);
anim->setStartValue(1.0); anim->setStartValue(1.0);
anim->setEndValue(0.0); anim->setEndValue(0.0);
anim->setEasingCurve(QEasingCurve::InExpo); anim->setEasingCurve(QEasingCurve::InExpo);
anim2 = new QPropertyAnimation(effect2,"opacity"); connect(anim,SIGNAL(finished()),this,SLOT(hide()));
anim2->setDuration(500);
anim2->setStartValue(1.0);
anim2->setEndValue(0.0);
anim2->setEasingCurve(QEasingCurve::InExpo);
anim2->start();
connect(anim,SIGNAL(finished()),this,SLOT(hide()));
textLabel = new QLabel(this); textLabel = new QLabel(this);
textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter); textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
@ -41,7 +31,6 @@ NotificationsLabelWidget::NotificationsLabelWidget(QWidget * parent)
//TODO check if the effects still be broken in OSX yet //TODO check if the effects still be broken in OSX yet
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
this->setGraphicsEffect(effect); this->setGraphicsEffect(effect);
textLabel->setGraphicsEffect(effect2);
#endif #endif
layout->addWidget(textLabel); layout->addWidget(textLabel);
@ -66,9 +55,7 @@ void NotificationsLabelWidget::flash()
{ {
updatePosition(); updatePosition();
anim->stop(); anim->stop();
anim2->stop();
anim->start(); anim->start();
anim2->start();
setVisible(true); setVisible(true);
} }

View File

@ -13,9 +13,7 @@ Q_OBJECT
private: private:
QLabel * textLabel; QLabel * textLabel;
QPropertyAnimation * anim; QPropertyAnimation * anim;
QPropertyAnimation * anim2;
QGraphicsOpacityEffect * effect; QGraphicsOpacityEffect * effect;
QGraphicsOpacityEffect * effect2;
protected: protected:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);