status-desktop/ui/StatusQ/sandbox/ThemeSwitch.qml

50 lines
1.1 KiB
QML
Raw Permalink Normal View History

import QtQuick 2.14
import QtQuick.Controls 2.14
import StatusQ.Controls 0.1
2021-06-03 14:15:14 +00:00
Item {
id: themeSwitchWrapper
signal checkedChanged()
property alias lightThemeEnabled: switchControl.checked
2021-06-03 14:15:14 +00:00
width: themeSwitch.width
height: themeSwitch.height
2021-06-03 14:15:14 +00:00
MouseArea {
id: sensor
hoverEnabled: true
anchors.fill: parent
2021-06-03 14:15:14 +00:00
Row {
id: themeSwitch
spacing: 2
Text {
text: "🌤"
font.pixelSize: 15
anchors.verticalCenter: parent.verticalCenter
}
2021-06-03 14:15:14 +00:00
StatusSwitch {
id: switchControl
2021-06-03 14:15:14 +00:00
onCheckedChanged: themeSwitchWrapper.checkedChanged()
StatusToolTip {
text: "Toggle Theme"
visible: sensor.containsMouse
orientation: StatusToolTip.Orientation.Bottom
y: themeSwitchWrapper.y + 16
}
}
Text {
text: "🌙"
font.pixelSize: 15
anchors.verticalCenter: parent.verticalCenter
}
}
}
}