1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Controls.Basic
import QtQuick.Layouts
Rectangle {
id: root
signal showHelp
signal toggleMode
color: Theme.backgroundColor
component Entry: ItemDelegate {
id: entryRoot
property bool heading: false
property alias source: entryRoot.icon.source
readonly property int iconSize: entryRoot.font.pixelSize
icon.height: iconSize
icon.width: iconSize
icon.color: Theme.iconNormal
palette.text: Theme.iconTextNormal
display: AbstractButton.TextBesideIcon
font.pixelSize: entryRoot.heading ? Theme.largeFontSize : Theme.mediumFontSize
font.weight: Theme.fontDefaultWeight
LayoutMirroring.enabled: true
LayoutMirroring.childrenInherit: true
background: Rectangle {
anchors.fill: parent
color: entryRoot.heading ? "transparent" : Theme.settingsEntryBackground
Rectangle {
height: 1
width: parent.width
anchors.bottom: parent.bottom
color: Theme.settingsSeparatorColor
}
}
}
ColumnLayout {
anchors {
fill: parent
topMargin: Theme.defaultSpacing
}
spacing: 0
Entry {
heading: true
text: qsTr("Settings")
bottomPadding: 20
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
}
Entry {
text: qsTr("Light Mode")
source: "icons/lightmode.svg"
visible: Theme.darkMode
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
onClicked: root.toggleMode()
}
Entry {
text: qsTr("Dark Mode")
source: "icons/darkmode.svg"
visible: !Theme.darkMode
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
onClicked: root.toggleMode()
}
Entry {
text: qsTr("Help")
source: "icons/help.svg"
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
onClicked: root.showHelp()
}
Item {
Layout.fillHeight: true
}
}
}
|