【QML】Row与RowLayout的区别
2019-04-26 本文已影响0人
4thirteen2one
https://stackoverflow.com/questions/29482970/what-is-the-difference-between-row-and-rowlayout
https://stackoverflow.com/questions/16914785/qml-row-vs-rowlayout
https://doc.qt.io/qt-5/qtquick-usecase-layouts.html
- 使用Row
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{ 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" } }