gpt4 book ai didi

qt - Row和RowLayout有什么区别?

转载 作者:行者123 更新时间:2023-12-04 00:38:05 26 4
gpt4 key购买 nike

此功能可用于Row,但不适用于RowLayout。为什么?两者有什么区别?

ApplicationWindow {    
title: "Testing"
width: 640
height: 480

//RowLayout {
Row {
anchors.fill: parent

Rectangle {
id: rect1
width: parent.width * 0.3
height: parent.height
color: "blue"
}
Rectangle {
height: parent.height
width: parent.width * 0.7
color: "red"
}
}
}

最佳答案

RowItem Positioner。定位器项是容器项,用于管理声明性用户界面中项的位置。

RowLayoutQt Quick Layouts的一部分。它们管理声明式用户界面上项目的位置和大小,非常适合可调整大小的用户界面。

您使用RowLayout的代码应如下所示:

RowLayout{
anchors.fill: parent
spacing: 0
Rectangle{
Layout.fillHeight: true
Layout.preferredWidth: parent.width * 0.3
color: "blue"
}
Rectangle{
Layout.fillHeight: true
Layout.fillWidth: true
color: "red"
}
}

关于qt - Row和RowLayout有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29482970/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com