mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-08 07:10:32 +00:00
88 lines
2.7 KiB
QML
88 lines
2.7 KiB
QML
|
import QtCore
|
||
|
import QtQuick
|
||
|
import QtQuick.Controls
|
||
|
import QtQuick.Controls.Basic
|
||
|
import QtQuick.Layouts
|
||
|
import mysettings
|
||
|
|
||
|
Item {
|
||
|
id: settingsStack
|
||
|
|
||
|
Theme {
|
||
|
id: theme
|
||
|
}
|
||
|
|
||
|
property ListModel tabTitlesModel: ListModel { }
|
||
|
property list<Component> tabs: [ ]
|
||
|
|
||
|
TabBar {
|
||
|
id: settingsTabBar
|
||
|
width: parent.width / 1.25
|
||
|
z: 200
|
||
|
Repeater {
|
||
|
model: settingsStack.tabTitlesModel
|
||
|
TabButton {
|
||
|
id: tabButton
|
||
|
contentItem: IconLabel {
|
||
|
color: theme.textColor
|
||
|
font.bold: tabButton.checked
|
||
|
text: model.title
|
||
|
}
|
||
|
background: Rectangle {
|
||
|
color: tabButton.checked ? theme.backgroundDarkest : theme.backgroundLight
|
||
|
Rectangle {
|
||
|
anchors.top: parent.top
|
||
|
anchors.left: parent.left
|
||
|
anchors.right: parent.right
|
||
|
height: tabButton.checked
|
||
|
color: theme.tabBorder
|
||
|
}
|
||
|
Rectangle {
|
||
|
anchors.bottom: parent.bottom
|
||
|
anchors.left: parent.left
|
||
|
anchors.right: parent.right
|
||
|
height: !tabButton.checked
|
||
|
color: theme.tabBorder
|
||
|
}
|
||
|
Rectangle {
|
||
|
anchors.top: parent.top
|
||
|
anchors.bottom: parent.bottom
|
||
|
anchors.left: parent.left
|
||
|
width: tabButton.checked
|
||
|
color: theme.tabBorder
|
||
|
}
|
||
|
Rectangle {
|
||
|
anchors.top: parent.top
|
||
|
anchors.bottom: parent.bottom
|
||
|
anchors.right: parent.right
|
||
|
width: tabButton.checked
|
||
|
color: theme.tabBorder
|
||
|
}
|
||
|
}
|
||
|
Accessible.role: Accessible.Button
|
||
|
Accessible.name: model.title
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
StackLayout {
|
||
|
id: stackLayout
|
||
|
anchors.top: settingsTabBar.bottom
|
||
|
anchors.left: parent.left
|
||
|
anchors.right: parent.right
|
||
|
anchors.bottom: parent.bottom
|
||
|
currentIndex: settingsTabBar.currentIndex
|
||
|
|
||
|
Repeater {
|
||
|
model: settingsStack.tabs
|
||
|
delegate: Loader {
|
||
|
id: loader
|
||
|
sourceComponent: model.modelData
|
||
|
onLoaded: {
|
||
|
settingsStack.tabTitlesModel.append({ "title": loader.item.title });
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|