aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/items/qquickwindow.cpp10
-rw-r--r--src/quick/items/qquickwindow.h1
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp2
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp2
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp2
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp15
6 files changed, 32 insertions, 0 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index f035e87d99..bc8558e1d8 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -3044,6 +3044,16 @@ QQmlIncubationController *QQuickWindow::incubationController() const
do so can result in the scene not rendering properly.
*/
+/*!
+ \fn void QQuickWindow::afterAnimating()
+
+ This signal is emitted on the gui thread before requesting the render thread to
+ perform the synchronization of the scene graph.
+
+ Unlike the other similar signals, this one is emitted on the gui thread instead
+ of the render thread. It can be used to synchronize external animation systems
+ with the QML content.
+ */
/*!
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index 233340d6fa..ced232467b 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -138,6 +138,7 @@ Q_SIGNALS:
void beforeSynchronizing();
void beforeRendering();
void afterRendering();
+ void afterAnimating();
Q_REVISION(1) void closing(QQuickCloseEvent *close);
void colorChanged(const QColor &);
Q_REVISION(1) void activeFocusItemChanged();
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 4e8fa67869..50c5b141c3 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -302,6 +302,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
cd->polishItems();
+ emit window->afterAnimating();
+
qint64 renderTime = 0, syncTime = 0;
QElapsedTimer renderTimer;
bool profileFrames = qsg_render_timing() || QQuickProfiler::enabled;
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index ffc6d31aa7..ddf724b89f 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -1096,6 +1096,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w)
w->updateDuringSync = false;
+ emit w->window->afterAnimating();
+
QSG_GUI_DEBUG(w->window, " - lock for sync...");
w->thread->mutex.lock();
m_locked = true;
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 995d80bb82..204a303d2c 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -442,6 +442,8 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
d->polishItems();
QSG_RENDER_TIMING_SAMPLE(time_polished);
+ emit window->afterAnimating();
+
RLDEBUG(" - syncing");
d->syncSceneGraph();
QSG_RENDER_TIMING_SAMPLE(time_synced);
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index bdd70f6a6e..edde8d2134 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -351,6 +351,8 @@ private slots:
void cursor();
#endif
+ void animatingSignal();
+
private:
QTouchDevice *touchDevice;
QTouchDevice *touchDeviceWithVelocity;
@@ -1657,6 +1659,19 @@ void tst_qquickwindow::qobjectEventFilter_mouse()
QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, point);
}
+void tst_qquickwindow::animatingSignal()
+{
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+
+ QSignalSpy spy(&window, SIGNAL(afterAnimating()));
+
+ window.show();
+ QTRY_VERIFY(window.isExposed());
+
+ QTRY_VERIFY(spy.count() > 1);
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"