From ab18b8cf86d7c73d709126e30d81d9609eec4295 Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Fri, 15 Feb 2019 17:15:55 +0900 Subject: add resize connection --- app/Dashboard.qml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Dashboard.qml b/app/Dashboard.qml index d343d8a..f33d074 100644 --- a/app/Dashboard.qml +++ b/app/Dashboard.qml @@ -24,8 +24,8 @@ import Translator 1.0 ApplicationWindow { id: root - width: container.width * container.scale - height: container.height * container.scale + width: screenInfo.width() + height: screenInfo.height() Translator { id: translator @@ -96,9 +96,19 @@ ApplicationWindow { id: container anchors.centerIn: parent width: 1080 - height: 1487 + height: 1488 scale: screenInfo.scale_factor() + Connections { + target: screenInfo + onSizeChanged: { + console.log("The application size changed !") + var w_scale = screenInfo.width() / container.width + var h_scale = screenInfo.height() / container.height + container.scale = w_scale < h_scale ? w_scale : h_scale + } + } + Label { id: speed anchors.left: parent.left @@ -305,6 +315,8 @@ ApplicationWindow { text: qsTr(model.language) onClicked: { translator.language = model.code + console.log ("width = " + screenInfo.width()) + console.log ("height = " + screenInfo.height()) console.log ("Scale = " + screenInfo.scale_factor()) } } -- cgit 1.2.3-korg