使用qmlscene测试以下QML源时,为什么TextArea不占用300像素的高度?据推测,height
是我必须使用的参数,它继承自Item。
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.3
Pane {
anchors.fill: parent
Rectangle {
id: new_dep_box
anchors.fill: parent
border.color: "gray"
Column {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
GridLayout {
anchors.left: parent.left
anchors.right: parent.right
columns: 2
anchors.margins: 5
Label {
anchors.left: parent.left
text: "Parent:"
}
Label {
text: "28383"
}
Label {
anchors.left: parent.left
text: "Recipient:"
}
TextField {
id: recipient
Layout.fillWidth: parent
anchors.right: parent.right
text: "user@example.com"
}
Label {
text: "Title:"
}
TextField {
anchors.right: parent.right
Layout.fillWidth: parent
text: "Title text"
}
Label {
text: "Description:"
}
TextArea {
height: 300
Layout.fillWidth: parent
text: "Sample"
}
}
Row {
Button {
text: " Cancel "
}
Button {
text: " Create "
}
}
}
}
}
另外,为什么不锚定“列”项目会使所有项目均匀地分布在整个空间中?我一直在阅读文档,但找不到任何相关信息。