summaryrefslogtreecommitdiffstats
path: root/examples/effects/fademessage
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-13 09:49:43 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-13 09:49:49 (GMT)
commit6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9 (patch)
tree94da799a697ebf32a98ccc13a53adfb2569f7c16 /examples/effects/fademessage
parentb664d54867139b371e158f1c63076c4a970cbb2a (diff)
parent4f2dcef95299f2da628b30607021e8deb1d868b6 (diff)
downloadQt-6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9.zip
Qt-6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9.tar.gz
Qt-6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9.tar.bz2
Merge oslo-staging-2/4.6 into upstream/4.6
Diffstat (limited to 'examples/effects/fademessage')
-rw-r--r--examples/effects/fademessage/fademessage.cpp18
-rw-r--r--examples/effects/fademessage/fademessage.h5
2 files changed, 12 insertions, 11 deletions
diff --git a/examples/effects/fademessage/fademessage.cpp b/examples/effects/fademessage/fademessage.cpp
index 28dd3bd..4128a59 100644
--- a/examples/effects/fademessage/fademessage.cpp
+++ b/examples/effects/fademessage/fademessage.cpp
@@ -43,7 +43,7 @@
#include <QtGui>
-FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent), m_index(0.0)
+FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent)
{
setScene(&m_scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -51,9 +51,12 @@ FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent), m_index(0.0)
setupScene();
- m_timeLine = new QTimeLine(500, this);
- m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve);
- connect(m_timeLine, SIGNAL(valueChanged(qreal)), m_effect, SLOT(setStrength(qreal)));
+ m_animation = new QPropertyAnimation(m_effect, "strength", this);
+ m_animation->setDuration(500);
+ m_animation->setEasingCurve(QEasingCurve::InOutSine);
+ m_animation->setStartValue(0);
+ m_animation->setEndValue(1);
+
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(QFrame::NoFrame);
@@ -63,13 +66,12 @@ void FadeMessage::togglePopup()
{
if (m_message->isVisible()) {
m_message->setVisible(false);
- m_timeLine->setDirection(QTimeLine::Backward);
- m_timeLine->start();
+ m_animation->setDirection(QAbstractAnimation::Backward);
} else {
m_message->setVisible(true);
- m_timeLine->setDirection(QTimeLine::Forward);
- m_timeLine->start();
+ m_animation->setDirection(QAbstractAnimation::Forward);
}
+ m_animation->start();
}
void FadeMessage::setupScene()
diff --git a/examples/effects/fademessage/fademessage.h b/examples/effects/fademessage/fademessage.h
index 34e2fb8..e73ef6b 100644
--- a/examples/effects/fademessage/fademessage.h
+++ b/examples/effects/fademessage/fademessage.h
@@ -44,7 +44,7 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include <QTimeLine>
+#include <QPropertyAnimation>
#include "fademessage.h"
@@ -62,11 +62,10 @@ private slots:
void togglePopup();
private:
- qreal m_index;
QGraphicsScene m_scene;
QGraphicsColorizeEffect *m_effect;
QGraphicsItem *m_message;
- QTimeLine *m_timeLine;
+ QPropertyAnimation *m_animation;
};
#endif // FADEMESSAGE_H