1
我想了解爲什麼在使用qmlscene
進行顯示時,此示例沒有繪製任何Rectangle
?是否可以合併和Column
組件以創建網格?瞭解行和列布局
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.3
Pane {
anchors.fill: parent
Row {
anchors.fill: parent
Column {
anchors.top: parent.top
anchors.bottom: parent.bottom
Rectangle {border.color: "red";color: "blue"; anchors.left: parent.left;anchors.right: parent.right; height: parent.height;width: parent.width}
}
Column {
anchors.top: parent.top
anchors.bottom: parent.bottom
Rectangle {border.color: "red";color: "green";anchors.left: parent.left;anchors.right: parent.right; height: parent.height; width: parent.width}
}
}
}
經過Qt 5.8的測試,我得到了一個空的白色屏幕。
關於「行」和「列」組件的關鍵點是它們不計算寬度或高度,它們只是按照連續順序放置項目。那是我的錯誤。 – Nulik