From: Gunnar Sletta Date: Thu, 5 May 2011 09:26:47 +0000 (+0200) Subject: Make animation driver pluggable through the QSGContext X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=55ff812974dd038a597cd968b66c07b6aeff74b2;p=konrad%2Fqtdeclarative.git Make animation driver pluggable through the QSGContext --- diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 1ac14a0..f2a5ccb 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 2a43d03..d604c83 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 848dd17..59522b6 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(); };