aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-05-05 11:26:47 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-05-06 07:27:28 +0200
commit55ff812974dd038a597cd968b66c07b6aeff74b2 (patch)
tree74bd30d0b73bfc011c62aa51ef9f0097ec82603e /src
parent24bb6f90f828c0dbed06a56536a3f33b35d36506 (diff)
Make animation driver pluggable through the QSGContext
Diffstat (limited to 'src')
-rw-r--r--src/declarative/items/qsgcanvas.cpp4
-rw-r--r--src/declarative/scenegraph/qsgcontext.cpp11
-rw-r--r--src/declarative/scenegraph/qsgcontext_p.h2
3 files changed, 15 insertions, 2 deletions
diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp
index 1ac14a0dea..f2a5ccb4e7 100644
--- a/src/declarative/items/qsgcanvas.cpp
+++ b/src/declarative/items/qsgcanvas.cpp
@@ -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()));
}
diff --git a/src/declarative/scenegraph/qsgcontext.cpp b/src/declarative/scenegraph/qsgcontext.cpp
index 2a43d03028..d604c830cb 100644
--- a/src/declarative/scenegraph/qsgcontext.cpp
+++ b/src/declarative/scenegraph/qsgcontext.cpp
@@ -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
diff --git a/src/declarative/scenegraph/qsgcontext_p.h b/src/declarative/scenegraph/qsgcontext_p.h
index 848dd17ad0..59522b6f73 100644
--- a/src/declarative/scenegraph/qsgcontext_p.h
+++ b/src/declarative/scenegraph/qsgcontext_p.h
@@ -113,6 +113,8 @@ public:
void setRenderAlpha(qreal renderAlpha);
qreal renderAlpha() const;
+ virtual QAnimationDriver *createAnimationDriver(QObject *parent);
+
signals:
void ready();
};