Make animation driver pluggable through the QSGContext
authorGunnar Sletta <gunnar.sletta@nokia.com>
Thu, 5 May 2011 09:26:47 +0000 (11:26 +0200)
committerGunnar Sletta <gunnar.sletta@nokia.com>
Fri, 6 May 2011 05:27:28 +0000 (07:27 +0200)
src/declarative/items/qsgcanvas.cpp
src/declarative/scenegraph/qsgcontext.cpp
src/declarative/scenegraph/qsgcontext_p.h

index 1ac14a0..f2a5ccb 100644 (file)
@@ -213,7 +213,7 @@ void QSGCanvas::showEvent(QShowEvent *e)
         d->contextInThread = true;
         doneCurrent();
         if (!d->animationDriver) {
-            d->animationDriver = new QAnimationDriver(this);
+            d->animationDriver = d->context->createAnimationDriver(this);
             connect(d->animationDriver, SIGNAL(started()), this, SLOT(_q_animationStarted()), Qt::DirectConnection);
             connect(d->animationDriver, SIGNAL(stopped()), this, SLOT(_q_animationStopped()), Qt::DirectConnection);
         }
@@ -227,7 +227,7 @@ void QSGCanvas::showEvent(QShowEvent *e)
 
         if (!d->context || !d->context->isReady()) {
             d->initializeSceneGraph();
-            d->animationDriver = new QAnimationDriver(this);
+            d->animationDriver = d->context->createAnimationDriver(this);
             connect(d->animationDriver, SIGNAL(started()), this, SLOT(update()));
         }
 
index 2a43d03..d604c83 100644 (file)
@@ -425,4 +425,15 @@ qreal QSGContext::renderAlpha() const
 }
 
 
+
+/*!
+    Creates a new animation driver.
+ */
+
+QAnimationDriver *QSGContext::createAnimationDriver(QObject *parent)
+{
+    return new QAnimationDriver(parent);
+}
+
+
 QT_END_NAMESPACE
index 848dd17..59522b6 100644 (file)
@@ -113,6 +113,8 @@ public:
     void setRenderAlpha(qreal renderAlpha);
     qreal renderAlpha() const;
 
+    virtual QAnimationDriver *createAnimationDriver(QObject *parent);
+
 signals:
     void ready();
 };