65 lines
1.4 KiB
QML
65 lines
1.4 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import qs.components
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
|
|
Item {
|
|
id: root
|
|
|
|
default property list<StyledTab> tabs
|
|
|
|
anchors.fill: parent
|
|
|
|
Container {
|
|
id: tabs
|
|
|
|
anchors.top: parent.top
|
|
anchors.left: parent.left
|
|
|
|
implicitHeight: 30
|
|
|
|
anchors.bottom: view.top
|
|
anchors.right: parent.right
|
|
|
|
contentItem: ListView {
|
|
model: tabs.contentModel
|
|
snapMode: ListView.SnapOneItem
|
|
orientation: ListView.Horizontal
|
|
}
|
|
|
|
Repeater {
|
|
model: root.tabs
|
|
delegate: StyledButton {
|
|
required property var modelData
|
|
required property var index
|
|
|
|
text: modelData.title
|
|
onClicked: tabs.setCurrentIndex(index)
|
|
}
|
|
}
|
|
}
|
|
|
|
SwipeView {
|
|
id: view
|
|
|
|
orientation: Qt.Horizontal
|
|
|
|
currentIndex: tabs.currentIndex
|
|
|
|
anchors.right: parent.right
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.top: tabs.bottom
|
|
anchors.left: parent.left
|
|
|
|
Repeater {
|
|
model: root.tabs
|
|
Loader {
|
|
required property var modelData
|
|
active: SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem
|
|
sourceComponent: modelData.content
|
|
}
|
|
}
|
|
}
|
|
}
|