在QML Row中添加一个可显示的分割符可以使用Item元素实现,具体步骤如下:
- 在Row中添加需要分隔的元素,例如:
Row {
Button { text: "Button 1" }
Button { text: "Button 2" }
Button { text: "Button 3" }
}
- 在每个元素后面添加一个Item元素,并设置其宽度和高度:
Row {
Button { text: "Button 1" }
Item { width: 10; height: parent.height; Rectangle { color: "black"; anchors.fill: parent } }
Button { text: "Button 2" }
Item { width: 10; height: parent.height; Rectangle { color: "black"; anchors.fill: parent } }
Button { text: "Button 3" }
}
在这个例子中,我们在每个按钮后面添加了一个宽度为10像素、高度与父元素相等的Item元素,并将其背景颜色设置为黑色。这样就可以在按钮之间添加可显示的分割符了。