feat: settings is now json, refactor panels to be able to dismiss by clicking outside
This commit is contained in:
parent
8a3d610d22
commit
a498671ef1
36 changed files with 1282 additions and 1300 deletions
|
|
@ -1,11 +1,10 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Settings
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property var tabsModel: [] // [{icon: "videocam", label: "Video"}, ...]
|
||||
property var tabsModel: []
|
||||
property int currentIndex: 0
|
||||
signal tabChanged(int index)
|
||||
|
||||
|
|
@ -16,17 +15,20 @@ Item {
|
|||
|
||||
Repeater {
|
||||
model: root.tabsModel
|
||||
delegate: Column {
|
||||
width: 56
|
||||
spacing: 2
|
||||
delegate: Rectangle {
|
||||
id: tabWrapper
|
||||
implicitHeight: tab.height
|
||||
implicitWidth: 56
|
||||
color: "transparent"
|
||||
|
||||
property bool hovered: false
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (root.currentIndex !== index) {
|
||||
root.currentIndex = index;
|
||||
root.tabChanged(index);
|
||||
if (currentIndex !== index) {
|
||||
currentIndex = index;
|
||||
tabChanged(index);
|
||||
}
|
||||
}
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
|
@ -35,43 +37,41 @@ Item {
|
|||
onExited: parent.hovered = false
|
||||
}
|
||||
|
||||
// Icon
|
||||
Text {
|
||||
text: modelData.icon
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 22
|
||||
color: index === root.currentIndex
|
||||
? (Theme ? Theme.accentPrimary : "#7C3AED")
|
||||
: parent.hovered
|
||||
? (Theme ? Theme.accentPrimary : "#7C3AED")
|
||||
: (Theme ? Theme.textSecondary : "#444")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
ColumnLayout {
|
||||
id: tab
|
||||
spacing: 2
|
||||
anchors.centerIn: parent
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
// Label
|
||||
Text {
|
||||
text: modelData.label
|
||||
font.pixelSize: 12
|
||||
font.bold: index === root.currentIndex
|
||||
color: index === root.currentIndex
|
||||
? (Theme ? Theme.accentPrimary : "#7C3AED")
|
||||
: parent.hovered
|
||||
? (Theme ? Theme.accentPrimary : "#7C3AED")
|
||||
: (Theme ? Theme.textSecondary : "#444")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
// Icon
|
||||
Text {
|
||||
text: modelData.icon
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 22
|
||||
color: index === root.currentIndex ? (Theme ? Theme.accentPrimary : "#7C3AED") : tabWrapper.hovered ? (Theme ? Theme.accentPrimary : "#7C3AED") : (Theme ? Theme.textSecondary : "#444")
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
|
||||
// Underline for active tab
|
||||
Rectangle {
|
||||
width: 24
|
||||
height: 2
|
||||
radius: 1
|
||||
color: index === root.currentIndex
|
||||
? (Theme ? Theme.accentPrimary : "#7C3AED")
|
||||
: "transparent"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
// Label
|
||||
Text {
|
||||
text: modelData.label
|
||||
font.pixelSize: 12
|
||||
font.bold: index === root.currentIndex
|
||||
color: index === root.currentIndex ? (Theme ? Theme.accentPrimary : "#7C3AED") : tabWrapper.hovered ? (Theme ? Theme.accentPrimary : "#7C3AED") : (Theme ? Theme.textSecondary : "#444")
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
|
||||
// Underline for active tab
|
||||
Rectangle {
|
||||
width: 24
|
||||
height: 2
|
||||
radius: 1
|
||||
color: index === root.currentIndex ? (Theme ? Theme.accentPrimary : "#7C3AED") : "transparent"
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue