import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.VirtualKeyboard 2.4
Window {
id: window
width: 640
height: 480
visible: true
title: qsTr("Hello World")
TextMetrics {
id: myText
font.pixelSize: 36
elideWidth: 220
text: "no connected"
elide: Qt.ElideRight
}
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: {
myText.text = "wo sdasd sdas sdsad sddada dsad sadqa"
}
onDoubleClicked: {
myText.text = "wosd"
}
}
Row {
spacing: 10
Rectangle {
width: 50
height: width
color: "red"
}
Text {
font.pixelSize: 36
color: "black"
text: myText.elidedText
}
Rectangle {
width: 50
height: width
color: "green"
}
}
InputPanel {
id: inputPanel
z: 99
x: 0
y: window.height
width: window.width
states: State {
name: "visible"
when: inputPanel.active
PropertyChanges {
target: inputPanel
y: window.height - inputPanel.height
}
}
transitions: Transition {
from: ""
to: "visible"
reversible: true
ParallelAnimation {
NumberAnimation {
properties: "y"
duration: 250
easing.type: Easing.InOutQuad
}
}
}
}
}
Qml文本自适应大小
最新推荐文章于 2024-05-13 21:41:51 发布