Qt 行和行布局之间的区别是什么?

Qt 行和行布局之间的区别是什么?,qt,qml,qtquick2,Qt,Qml,Qtquick2,这与行的预期效果相同,但与行布局的效果不同。为什么?这两者的区别是什么 ApplicationWindow { title: "Testing" width: 640 height: 480 //RowLayout { Row { anchors.fill: parent Rectangle { id: rect1 width: parent.wid

这与
的预期效果相同,但与
行布局
的效果不同。为什么?这两者的区别是什么

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"
        }
    }
}
是一个。定位器项是在声明性用户界面中管理项位置的容器项

RowLayout
是的一部分。它们管理声明性用户界面上项目的位置和大小,非常适合于可调整大小的用户界面

带有
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"
    }
}

使用类似对齐的
行布局
可以提供更多选项。但最好使用
,因为性能。的可能重复项作为Meefte的额外答案。行是,行布局是。它们的行为方式相似,但有两个区别:-项目定位器本身也是容器。-Qt快速布局可以调整项目大小。虽然这是唯一的答案,但我觉得这不是一个有用的答案。它只是复制了文档,可以说这并不能揭开差异的神秘面纱,所以这就是问题所在<代码>行是一个“项目定位器”。那又怎样<代码>行布局是QT快速布局的一部分。嗯,
也是QTQuick的一部分。概念和用途的实际和根本区别是什么?!?!