From e91a218a47f505364221c33af622ac65f6c6afd8 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Wed, 15 Apr 2020 23:48:02 +0300 Subject: [PATCH] sample/app/main: Remove flickable and make it more resilient Signed-off-by: Marius Vlad --- sample/app/main.qml | 54 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/sample/app/main.qml b/sample/app/main.qml index 609c637..b545c53 100644 --- a/sample/app/main.qml +++ b/sample/app/main.qml @@ -25,6 +25,10 @@ ApplicationWindow { property string mapp_id: '' property string mapp_data_msg: '' + // position of the pop-up + property int x: 200 + property int y: 200 + Label { id: title width: parent.width @@ -42,24 +46,24 @@ ApplicationWindow { anchors.horizontalCenter: title.horizontalCenter // show received reply information area - Flickable { - id: flickable - width: 800 - height: 320 - Layout.alignment: Qt.AlignCenter - flickableDirection: Flickable.VerticalFlick - boundsBehavior: Flickable.StopAtBounds - - TextArea.flickable: TextArea { - id: output - text: "show received reply information area\n...\n...\n...\n...\n" - font.pixelSize: 24 - wrapMode: TextArea.Wrap - color: '#00ADDC' - } - - ScrollBar.vertical: ScrollBar { } - } + //Flickable { + // id: flickable + // width: 400 + // height: 220 + // Layout.alignment: Qt.AlignCenter + // flickableDirection: Flickable.VerticalFlick + // boundsBehavior: Flickable.StopAtBounds + + // TextArea.flickable: TextArea { + // id: output + // text: "show received reply information area\n...\n...\n...\n...\n" + // font.pixelSize: 12 + // wrapMode: TextArea.Wrap + // color: '#00ADDC' + // } + + // ScrollBar.vertical: ScrollBar { } + // } // select onscreen type area GroupBox { @@ -366,7 +370,7 @@ ApplicationWindow { if (!onscreen_role_set) { console.log("onscreen_role_set is not set") - eventHandler.set_window_popup(onsId, 0, 218) + eventHandler.set_window_popup(onsId, x, y) console.log("setting for popup for " + onsId) onscreen_role_set = true } @@ -385,13 +389,21 @@ ApplicationWindow { armTimer(onsId, postmsg) } else { // onscreenapp is already start we just need to activate + pass the data - eventHandler.showWindow(mapp_id, mapp_data_msg) + if (!eventHandler.is_running(onsId) && pid > 0) { + // this is mostly for testing, in case onscreenapp died + // unexpectedly + eventHandler.set_window_popup(onsId, x, y) + pid = eventHandler.start(onsId, postmsg) + armTimer(onsId, postmsg) + } else { + eventHandler.showWindow(onsId, postmsg) + } } } function qmlOnReplyShowWindow(text) { console.log("onstestapp received:",text); - output.text = text; + //output.text = text; } } -- 2.16.6