From: http://doc.qt.io/qt-5/qml-qtquick-controls-tabview.html#details
TabView
{
Tab {
title: "Red"
Rectangle { color: "red" }
}
Tab {
title: "Blue"
Rectangle { color: "blue" }
}
Tab {
title: "Green"
Rectangle { color: "green" }
}
}
These tabs get by default shown in a horizontal bar. How to display them in separate rows?
Like this:
Tab1
Tab2
Tab3
Rather than:
Tab1 Tab2 Tab3
You need to hide standard tab bar, and create your own vertical bar.
Row {
Column {
Repeater {
model: view.count
Rectangle {
width: 100
height: 40
border.width: 1
Text {
anchors.centerIn: parent
text: view.getTab(index).title
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: view.currentIndex = index
}
}
}
}
TabView {
id: view
style: TabViewStyle {
tab: Item {}
}
Tab {
title: "Red"
Rectangle { color: "red" }
}
Tab {
title: "Blue"
Rectangle { color: "blue" }
}
Tab {
title: "Green"
Rectangle { color: "green" }
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With