From 8a7e205eed38ff506d3768083047d1caf8481303 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 12 Dec 2017 12:06:48 +0100 Subject: threadedanimation: fix custom item animation when in a QQuickWidget As with 64a01ff5b5d1eaadb1e60013673ac25459b79e14 in qtquickcontrols2, we ensure that custom scenegraph item animations still run if within a QQuickWidget. Change-Id: I3630ee34c039420640000c9a58ed1ec186bbe82c Reviewed-by: J-P Nurmi --- examples/quick/scenegraph/threadedanimation/spinner.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'examples/quick') diff --git a/examples/quick/scenegraph/threadedanimation/spinner.cpp b/examples/quick/scenegraph/threadedanimation/spinner.cpp index 7b4281aafc..83c4494720 100644 --- a/examples/quick/scenegraph/threadedanimation/spinner.cpp +++ b/examples/quick/scenegraph/threadedanimation/spinner.cpp @@ -66,8 +66,8 @@ public: , m_spinning(false) , m_window(window) { - connect(window, &QQuickWindow::beforeRendering, this, &SpinnerNode::maybeRotate); - connect(window, &QQuickWindow::frameSwapped, this, &SpinnerNode::maybeUpdate); + connect(window, &QQuickWindow::beforeRendering, this, &SpinnerNode::maybeRotate, Qt::DirectConnection); + connect(window, &QQuickWindow::frameSwapped, this, &SpinnerNode::maybeUpdate, Qt::DirectConnection); QImage image(":/scenegraph/threadedanimation/spinner.png"); m_texture = window->createTextureFromImage(image); @@ -96,6 +96,9 @@ public slots: matrix.rotate(m_rotation, 0, 0, 1); matrix.translate(-32, -32); setMatrix(matrix); + + // If we're inside a QQuickWidget, this call is necessary to ensure the widget gets updated. + m_window->update(); } } -- cgit v1.2.3