status-qml/sandbox/ThemeSwitch.qml

47 lines
1.0 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()
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 {
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
}
}
}
}