QT开发中文网

QML Row每一个元素间添加一个可显示的分割符

在QML Row中添加一个可显示的分割符可以使用Item元素实现,具体步骤如下:

  1. 在Row中添加需要分隔的元素,例如:
   Row {
       Button { text: "Button 1" }
       Button { text: "Button 2" }
       Button { text: "Button 3" }
   }
  1. 在每个元素后面添加一个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元素,并将其背景颜色设置为黑色。这样就可以在按钮之间添加可显示的分割符了。

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://qt.0voice.com/?id=1892

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?