From b8ffb6e53dda5a7170592cc86f043c07cb4d4195 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 13 Sep 2018 14:33:38 -0700 Subject: [PATCH] Delay Session::exec() for 250 ms to allow the StackView transition to complete --- app/gui/StreamSegue.qml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/app/gui/StreamSegue.qml b/app/gui/StreamSegue.qml index 9ed6fa00..785e371c 100644 --- a/app/gui/StreamSegue.qml +++ b/app/gui/StreamSegue.qml @@ -57,6 +57,26 @@ Item { toast.visible = true } + // This timer delay allows the transition + // to this StreamSegue to complete before doing + // long operations in Session::exec(). It would + // be nice if we could find a way to avoid having + // to do this though. + Timer { + id: delayedStartTimer + interval: 250 + onTriggered: { + // Run the streaming session to completion + session.exec(Screen.virtualX, Screen.virtualY) + + // Show the Qt window again after streaming + window.visible = true + + // Exit this view + stackView.pop() + } + } + onVisibleChanged: { if (visible) { // Hide the toolbar before we start loading @@ -69,14 +89,8 @@ Item { session.displayLaunchError.connect(displayLaunchError) session.displayLaunchWarning.connect(displayLaunchWarning) - // Run the streaming session to completion - session.exec(Screen.virtualX, Screen.virtualY) - - // Show the Qt window again after streaming - window.visible = true - - // Exit this view - stackView.pop() + // Kick off the delayed start + delayedStartTimer.running = true } else { // Show the toolbar again when we become hidden