使用文本和矩形设计qml中的3个中间点(…)
我想在qml中使用文本和矩形设计3个点,如下所示 。。。你好,世界 但我的要求是,如图所示,矩形和文本(Hello World)中间应有3个点。如何做到这一点使用文本和矩形设计qml中的3个中间点(…),qml,Qml,我想在qml中使用文本和矩形设计3个点,如下所示 。。。你好,世界 但我的要求是,如图所示,矩形和文本(Hello World)中间应有3个点。如何做到这一点 当我第一次思考时,我想到了两种方法: 1-借助html代码样式使用中间点可以实现这一点。以下是您可以在qml中轻松使用的 以下是示例和输出: Window { visible: true width: 640 height: 480 title: qsTr("Hello World")
当我第一次思考时,我想到了两种方法: 1-借助
html代码样式使用中间点可以实现这一点。以下是您可以在qml
中轻松使用的
以下是示例和输出:
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Rectangle{
id:sample1
anchors.centerIn: parent
width: 200
height: 50
border.color: "black"
Text {
id: mytext
anchors.centerIn: parent
textFormat: Text.RichText
text: "·" + "·" + "·" + " Hello World " + "·" + "·" + "·"
}
}
}
输出:
2-您可以先放置“Hello world”文本,然后为点创建另一个文本,并将点放置在主文本旁边的中间坐标中。这种方法不是一种很好的方法
注意:当我深入研究其他可能的解决方案时,我无法找到一个合适的解决方案来实现这一点。当我第一次思考时,我想到了两种方法:
1-借助html代码样式使用中间点可以实现这一点。以下是您可以在qml
中轻松使用的
以下是示例和输出:
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Rectangle{
id:sample1
anchors.centerIn: parent
width: 200
height: 50
border.color: "black"
Text {
id: mytext
anchors.centerIn: parent
textFormat: Text.RichText
text: "·" + "·" + "·" + " Hello World " + "·" + "·" + "·"
}
}
}
输出:
2-您可以先放置“Hello world”文本,然后为点创建另一个文本,并将点放置在主文本旁边的中间坐标中。这种方法不是一种很好的方法
注意:当我深入研究其他可能的解决方案时,我找不到合适的解决方案来实现这一点。非常感谢。html代码样式解决了我的问题。非常感谢。html代码样式解决了我的问题。