aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2017-12-12 12:06:48 +0100
committerMitch Curtis <mitch.curtis@qt.io>2017-12-20 09:18:25 +0000
commit8a7e205eed38ff506d3768083047d1caf8481303 (patch)
treecf018b69c0aea16fb0594fa593f28e5ac4042342 /examples/quick
parent7628316e6e8165415dd84f2f8744a3ddd29bd675 (diff)
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 <jpnurmi@qt.io>
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/scenegraph/threadedanimation/spinner.cpp7
1 files changed, 5 insertions, 2 deletions
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();
}
}