From 1ac430cdc03e1b00bae6cbef4b5e216c1ee13767 Mon Sep 17 00:00:00 2001 From: Bumsik Kim Date: Sun, 27 May 2018 00:44:32 -0400 Subject: [PATCH] AppWindow: Improved releiability of auto-closing window --- virtscreen/qml/AppWindow.qml | 2 +- virtscreen/qml/main.qml | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/virtscreen/qml/AppWindow.qml b/virtscreen/qml/AppWindow.qml index ae63d88..697b018 100644 --- a/virtscreen/qml/AppWindow.qml +++ b/virtscreen/qml/AppWindow.qml @@ -10,7 +10,7 @@ ApplicationWindow { id: window visible: false flags: Qt.FramelessWindowHint - title: "Basic layouts" + title: "VirtScreen" property int theme_color: settings.theme_color Material.theme: Material.Light diff --git a/virtscreen/qml/main.qml b/virtscreen/qml/main.qml index 99a4dbe..ffc6588 100644 --- a/virtscreen/qml/main.qml +++ b/virtscreen/qml/main.qml @@ -40,6 +40,9 @@ Item { Timer { id: timer function setTimeout(cb, delayTime) { + if (timer.running) { + console.log('Timer is already running!'); + } timer.interval = delayTime; timer.repeat = false; timer.triggered.connect(cb); @@ -97,9 +100,6 @@ Item { window.show(); window.raise(); window.requestActivate(); - timer.setTimeout (function() { - sysTrayIcon.clicked = false; - }, 200); } } @@ -111,7 +111,7 @@ Item { "../icon/icon.png" visible: true property bool clicked: false - onMessageClicked: console.log("Message clicked") + Component.onCompleted: { // without delay, the message appears in a wierd place timer.setTimeout (function() { @@ -127,6 +127,9 @@ Item { return; } sysTrayIcon.clicked = true; + timer.setTimeout (function() { + sysTrayIcon.clicked = false; + }, 200); mainLoader.active = true; }