From cd2fa3d0b7915ff64261b4ae15d5d04af4bb5bb0 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Thu, 3 Jun 2021 16:15:14 +0200 Subject: [PATCH] chore: add tooltip to theme switch --- ui/StatusQ/sandbox/ThemeSwitch.qml | 50 ++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/ui/StatusQ/sandbox/ThemeSwitch.qml b/ui/StatusQ/sandbox/ThemeSwitch.qml index fcca56a7f5..970d00ba1a 100644 --- a/ui/StatusQ/sandbox/ThemeSwitch.qml +++ b/ui/StatusQ/sandbox/ThemeSwitch.qml @@ -3,26 +3,44 @@ import QtQuick.Controls 2.14 import StatusQ.Controls 0.1 -Row { - id: themeSwitch +Item { + id: themeSwitchWrapper signal checkedChanged() - spacing: 2 + width: themeSwitch.width + height: themeSwitch.height - Text { - text: "🌤" - font.pixelSize: 15 - anchors.verticalCenter: parent.verticalCenter - } + MouseArea { + id: sensor + hoverEnabled: true + anchors.fill: parent - StatusSwitch { - onCheckedChanged: themeSwitch.checkedChanged() - } + Row { + id: themeSwitch + spacing: 2 - Text { - text: "🌙" - font.pixelSize: 15 - anchors.verticalCenter: parent.verticalCenter + Text { + text: "🌤" + font.pixelSize: 15 + anchors.verticalCenter: parent.verticalCenter + } + + 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 + } + } } } -