diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index 34d07d7..5f8f1d9 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -33,32 +33,13 @@ PanelWindow { // Testing widgets RowLayout { - NToggle { - label: "Label" - description: "Description" - onToggled: function(value: bool) { - console.log("NToggle: " + value) - } - } - NIconButton { - id: myIconButton - icon: "refresh" - onEntered: function() { - myTooltip.show(); - } - onExited: function() { - myTooltip.hide(); + id: demoPanelToggler + icon: "experiment" + onClicked: function () { + demoPanel.visible ? demoPanel.hide() : demoPanel.show() } } - NTooltip { - id: myTooltip - target: myIconButton - positionAbove: false - text: "Hello world" - } - - NSlider {} Clock {} } diff --git a/Modules/Bar/Clock.qml b/Modules/Bar/Clock.qml index fc15665..4a94e21 100644 --- a/Modules/Bar/Clock.qml +++ b/Modules/Bar/Clock.qml @@ -37,7 +37,7 @@ Rectangle { onClicked: function () { calendar.visible = !calendar.visible if (calendar.visible) { - tooltip.hide(); + tooltip.hide() } } } diff --git a/Modules/DemoPanel/DemoPanel.qml b/Modules/DemoPanel/DemoPanel.qml new file mode 100644 index 0000000..72b98b2 --- /dev/null +++ b/Modules/DemoPanel/DemoPanel.qml @@ -0,0 +1,72 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell +import Quickshell.Wayland +import qs.Services +import qs.Widgets + +/* + An experiment/demo panel to tweaks widgets +*/ + + +NPanel { + id: root + + readonly property real scaling: Scaling.scale(screen) + + Rectangle { + color: Theme.backgroundPrimary + radius: Style.radiusMedium * scaling + border.color: Theme.backgroundTertiary + border.width: Math.max(1, 1.5 * scale) + width: 340 * scaling + height: 200 + anchors.top: parent.top + anchors.right: parent.right + anchors.topMargin: 4 * scaling + anchors.rightMargin: 4 * scaling + + // Prevent closing when clicking in the panel bg + MouseArea { + anchors.fill: parent + } + + ColumnLayout { + anchors.fill: parent + anchors.margins: 16 * scaling + spacing: 12 * scaling + + NToggle { + label: "Label" + description: "Description" + onToggled: function(value: bool) { + console.log("NToggle: " + value) + } + } + + NIconButton { + id: myIconButton + icon: "refresh" + onEntered: function() { + myTooltip.show(); + } + onExited: function() { + myTooltip.hide(); + } + } + + NTooltip { + id: myTooltip + target: myIconButton + positionAbove: false + text: "Hello world" + } + + NSlider {} + + + } + } +}