为什么当我在s 中注释掉时,在下面implicitWidth
的更改代码中?为什么我将组件设置为等于它的事实会改变?另外,我认为在未明确设置时默认设置为。所以我不明白为什么做会有任何影响。这是代码:TabBar
width: implicitWidth
TabButton
width
implicitWidth
implicitWidth
width
implicitWidth
width
width: implicitWidth
Item {
id: root
height: 480
width: 640
RowLayout {
anchors.fill: parent
TabBar {
id: bar
Layout.fillHeight: true
implicitWidth: Math.max(homeTabButton.implicitWidth, discoverTabButton.implicitWidth, activityTabButton.implicitWidth)
background: Rectangle {
color: "yellow"
}
contentItem: ListView {
model: bar.contentModel
}
TabButton {
id: homeTabButton
width: implicitWidth // I cannot comment this out
text: qsTr("Home")
}
TabButton {
id: discoverTabButton
width: implicitWidth // I cannot comment this out
text: qsTr("Discover")
}
TabButton {
id: activityTabButton
width: implicitWidth // I cannot comment this out
text: qsTr("Activity")
}
}
StackLayout {
Layout.fillWidth: true
Layout.fillHeight: true
currentIndex: bar.currentIndex
Pane {
id: homeTab
background: Rectangle {
color: "blue"
}
}
Pane {
id: discoverTab
background: Rectangle {
color: "red"
}
}
Pane {
id: activityTab
background: Rectangle {
color: "green"
}
}
}
}
}