summaryrefslogtreecommitdiffstats
path: root/examples/graphicsview/padnavigator/splashitem.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-05-22 10:17:59 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-05-22 10:17:59 (GMT)
commit42fe40e777a35818dcb9f7cd00ddf93e44477e36 (patch)
tree2b4f675826d5d57cbece5ad9b4dc89d470453342 /examples/graphicsview/padnavigator/splashitem.cpp
parentd0ac49ec731f0781ba48f8f5d8ce04e19ce0010d (diff)
downloadQt-42fe40e777a35818dcb9f7cd00ddf93e44477e36.zip
Qt-42fe40e777a35818dcb9f7cd00ddf93e44477e36.tar.gz
Qt-42fe40e777a35818dcb9f7cd00ddf93e44477e36.tar.bz2
Revert "update the padnavigator example and suppress the padnavigator-ng"
This reverts commit 1cad8c56002a61a6240e6580cdbd784209821fa6. Conflicts: examples/graphicsview/padnavigator/roundrectitem.cpp
Diffstat (limited to 'examples/graphicsview/padnavigator/splashitem.cpp')
-rw-r--r--examples/graphicsview/padnavigator/splashitem.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/examples/graphicsview/padnavigator/splashitem.cpp b/examples/graphicsview/padnavigator/splashitem.cpp
index a83d4d5..2a374bf 100644
--- a/examples/graphicsview/padnavigator/splashitem.cpp
+++ b/examples/graphicsview/padnavigator/splashitem.cpp
@@ -46,6 +46,12 @@
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"
@@ -55,6 +61,7 @@ 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());
@@ -72,14 +79,14 @@ void SplashItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWid
void SplashItem::keyPressEvent(QKeyEvent * /* event */)
{
- QVariantAnimation *anim = new QPropertyAnimation(this, "pos");
- anim->setEndValue(QPointF(x(), scene()->sceneRect().top() - rect().height()));
- anim->setDuration(350);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-
- anim = new QPropertyAnimation(this, "opacity");
- anim->setEndValue(0);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
+ if (timeLine->state() == QTimeLine::NotRunning)
+ timeLine->start();
+}
- connect(anim, SIGNAL(finished()), SLOT(close()));
+void SplashItem::setValue(qreal value)
+{
+ opacity = 1 - value;
+ setPos(x(), scene()->sceneRect().top() - rect().height() * value);
+ if (value == 1)
+ hide();
}