forked from openkylin/ukui-search
Fix: the app widget will display a exception while zooming.
This commit is contained in:
parent
5254c49ffa
commit
95736ef771
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue