aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/SectionHeader.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/SectionHeader.qml')
-rw-r--r--desktop/SectionHeader.qml49
1 files changed, 49 insertions, 0 deletions
diff --git a/desktop/SectionHeader.qml b/desktop/SectionHeader.qml
new file mode 100644
index 0000000..6bbe07a
--- /dev/null
+++ b/desktop/SectionHeader.qml
@@ -0,0 +1,49 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+
+// A drawer page's section title: accent glyph, bold label, and a divider
+// with space above it, which is what separates the sections. The divider is
+// at 0.3: the 0.12 one the pages used before read too faint. The first
+// section of a page sets divider: false. Children (a switch, a level) are
+// laid on the right; anchor them to the bottom, where the label sits.
+Item {
+ property string glyph
+ property string label
+ property bool divider: true
+
+ width: parent ? parent.width : 0
+ implicitHeight: headerText.implicitHeight + (divider ? 18 : 10)
+
+ Rectangle {
+ visible: parent.divider
+ width: parent.width
+ height: 1
+ color: Qt.alpha(Theme.text, 0.3)
+ }
+
+ Text {
+ id: headerGlyph
+ anchors { left: parent.left; verticalCenter: headerText.verticalCenter }
+ text: parent.glyph
+ font { family: Theme.iconFamily; pixelSize: Theme.fontSize }
+ color: Theme.accent
+ }
+
+ Text {
+ id: headerText
+ anchors { left: headerGlyph.right; leftMargin: 8; bottom: parent.bottom }
+ text: parent.label
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize + 1; bold: true }
+ color: Theme.text
+ }
+}