From 95736ef7710501ae6b4345b6346a6bb930597661 Mon Sep 17 00:00:00 2001 From: JunjieBai Date: Fri, 28 Oct 2022 14:30:34 +0800 Subject: [PATCH] Fix: the app widget will display a exception while zooming. --- .../provider/data/search.qml | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libsearch/search-app-widget-plugin/provider/data/search.qml b/libsearch/search-app-widget-plugin/provider/data/search.qml index e096b43..7b9bc02 100755 --- a/libsearch/search-app-widget-plugin/provider/data/search.qml +++ b/libsearch/search-app-widget-plugin/provider/data/search.qml @@ -7,12 +7,13 @@ import org.ukui.appwidget 1.0 import org.ukui.qqc2style.private 1.0 as StylePrivate AppWidget { - width: 640 - height: 100 visible: true id: window appname: "search" username: parent.username + anchors.fill: parent + + property real scaling: parent.width / 480 function parseJson(jsonStr) { try { @@ -43,8 +44,8 @@ AppWidget { Rectangle { id:searchBar anchors.centerIn: parent - width:448 - height: 64 + width : 448 * scaling + height: 64 * scaling radius: searchBar.height / 2 RowLayout { @@ -54,10 +55,10 @@ AppWidget { Image { id: image_search - Layout.leftMargin: 16 - Layout.rightMargin: 16 - Layout.preferredWidth: 32; - Layout.preferredHeight: 32; + Layout.leftMargin: 16 * scaling; + Layout.rightMargin: 16 * scaling; + Layout.preferredWidth: 32 * scaling; + Layout.preferredHeight: 32 * scaling; Layout.alignment: Qt.AlignVCenter source: "file:///usr/share/appwidget/search/ukui-search.svg" @@ -67,7 +68,7 @@ AppWidget { clip: true; Layout.fillWidth: true Layout.fillHeight: true; - Layout.rightMargin: 32; + Layout.rightMargin: 32 * scaling; TextInput { id: searchtext @@ -85,17 +86,17 @@ AppWidget { focus: true color: StylePrivate.StyleHelper.windowtextcolorrole - maximumLength: 100 + maximumLength: 100 * scaling selectByMouse: true verticalAlignment: Qt.AlignVCenter - font.pixelSize: 21 + font.pixelSize: 21 * scaling property string placeholderText: /*qsTr("search")*/"全局搜索" Text { id: placeholderText text: searchtext.placeholderText - font.pixelSize: 21 + font.pixelSize: 21 * scaling visible: !searchtext.text anchors.verticalCenter: parent.verticalCenter