diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-20 15:16:48 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-20 15:17:27 (GMT) |
commit | 1cad8c56002a61a6240e6580cdbd784209821fa6 (patch) | |
tree | fce7cb89eca27a6acf5ebd948f63a85d34af55cc /examples/graphicsview/padnavigator/splashitem.cpp | |
parent | 8769a71f56886ea4925fc460a553f53500dd0b4e (diff) | |
download | Qt-1cad8c56002a61a6240e6580cdbd784209821fa6.zip Qt-1cad8c56002a61a6240e6580cdbd784209821fa6.tar.gz Qt-1cad8c56002a61a6240e6580cdbd784209821fa6.tar.bz2 |
update the padnavigator example and suppress the padnavigator-ng
Diffstat (limited to 'examples/graphicsview/padnavigator/splashitem.cpp')
-rw-r--r-- | examples/graphicsview/padnavigator/splashitem.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/examples/graphicsview/padnavigator/splashitem.cpp b/examples/graphicsview/padnavigator/splashitem.cpp index 2a374bf..a83d4d5 100644 --- a/examples/graphicsview/padnavigator/splashitem.cpp +++ b/examples/graphicsview/padnavigator/splashitem.cpp @@ -46,12 +46,6 @@ SplashItem::SplashItem(QGraphicsItem *parent) : QGraphicsWidget(parent) { - opacity = 1.0; - - - timeLine = new QTimeLine(350); - timeLine->setCurveShape(QTimeLine::EaseInCurve); - connect(timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(setValue(qreal))); text = tr("Welcome to the Pad Navigator Example. You can use the" " keyboard arrows to navigate the icons, and press enter" @@ -61,7 +55,6 @@ SplashItem::SplashItem(QGraphicsItem *parent) void SplashItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { - painter->setOpacity(opacity); painter->setPen(QPen(Qt::black, 2)); painter->setBrush(QColor(245, 245, 255, 220)); painter->setClipRect(rect()); @@ -79,14 +72,14 @@ void SplashItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWid void SplashItem::keyPressEvent(QKeyEvent * /* event */) { - if (timeLine->state() == QTimeLine::NotRunning) - timeLine->start(); -} + QVariantAnimation *anim = new QPropertyAnimation(this, "pos"); + anim->setEndValue(QPointF(x(), scene()->sceneRect().top() - rect().height())); + anim->setDuration(350); + anim->start(QAbstractAnimation::DeleteWhenStopped); -void SplashItem::setValue(qreal value) -{ - opacity = 1 - value; - setPos(x(), scene()->sceneRect().top() - rect().height() * value); - if (value == 1) - hide(); + anim = new QPropertyAnimation(this, "opacity"); + anim->setEndValue(0); + anim->start(QAbstractAnimation::DeleteWhenStopped); + + connect(anim, SIGNAL(finished()), SLOT(close())); } |