Window {
visible: true
width: 480
height: 360
//flags: Qt.FramelessWindowHint
title: qsTr("TabBar")
//color: "#000"
TabBar {
id: bar
width: parent.width
TabButton {
id : btn1
text: qsTr("Home")
//width: 100
//height: parent.height
background: Rectangle{
implicitWidth: 100
implicitHeight: 40
opacity: enabled ? 1 : 0.3
color: btn1.down ? "#d0d0d0" : "#e0e0e0"
}
}
TabButton {
id : btn2
text: qsTr("Discover")
//width: 100
//height: parent.height
background:Rectangle {
implicitWidth: 100
implicitHeight: 40
opacity: enabled ? 1 : 0.3
color: btn2.down ? "#d0d0d0" : "#e0e0e0"
}
}
TabButton {
id : btn3
text: qsTr("Activity")
//width: 100
//height: parent.height
background:Rectangle {
implicitWidth: 100
implicitHeight: 40
opacity: enabled ? 1 : 0.3
color: btn3.down ? "#d0d0d0" : "#e0e0e0"
}
}
}
StackLayout {
width: parent.width
currentIndex: bar.currentIndex
anchors.top: bar.bottom
Item {
id: homeTab
Text {
text: qsTr("homeTab")
}
}
Item {
id: discoverTab
Text {
text: qsTr("discoverTab")
}
}
Item {
id: activityTab
Text {
text: qsTr("activityTab")
}
}
}
}
qml TabBar的使用
最新推荐文章于 2025-03-05 08:00:00 发布