DemoPanel

This commit is contained in:
quadbyte 2025-08-09 18:23:45 -04:00
parent 5d6b82a80e
commit 05b76b96b3
4 changed files with 17 additions and 12 deletions

View file

@ -8,15 +8,15 @@ import qs.Services
import "../Helpers/Holidays.js" as Holidays import "../Helpers/Holidays.js" as Holidays
NPanel { NPanel {
id: calendarOverlay id: root
readonly property real scaling: Scaling.scale(screen) readonly property real scaling: Scaling.scale(screen)
Rectangle { Rectangle {
color: Theme.backgroundPrimary color: Theme.backgroundPrimary
radius: 12 radius: Style.radiusMedium * scaling
border.color: Theme.backgroundTertiary border.color: Theme.backgroundTertiary
border.width: 1 border.width: Math.max(1, 1.5 * scale)
width: 340 * scaling width: 340 * scaling
height: 380 height: 380
anchors.top: parent.top anchors.top: parent.top
@ -31,8 +31,8 @@ NPanel {
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: 16 anchors.margins: 16 * scaling
spacing: 12 spacing: 12 * scaling
// Month/Year header with navigation // Month/Year header with navigation
RowLayout { RowLayout {
@ -113,14 +113,14 @@ NPanel {
// Optionally, update when the panel becomes visible // Optionally, update when the panel becomes visible
Connections { Connections {
function onVisibleChanged() { function onVisibleChanged() {
if (calendarOverlay.visible) { if (root.visible) {
calendar.month = Time.date.getMonth() calendar.month = Time.date.getMonth()
calendar.year = Time.date.getFullYear() calendar.year = Time.date.getFullYear()
calendar.updateHolidays() calendar.updateHolidays()
} }
} }
target: calendarOverlay target: root
} }
delegate: Rectangle { delegate: Rectangle {
@ -179,8 +179,8 @@ NPanel {
return h.localName + (h.name !== h.localName ? " (" + h.name + ")" : "") return h.localName + (h.name !== h.localName ? " (" + h.name + ")" : "")
+ (h.global ? " [Global]" : "") + (h.global ? " [Global]" : "")
}).join(", ") }).join(", ")
holidayTooltip.target = parent; holidayTooltip.target = parent
holidayTooltip.show(); holidayTooltip.show()
} }
} }
onExited: holidayTooltip.hide() onExited: holidayTooltip.hide()

View file

@ -11,7 +11,7 @@ PanelWindow {
property int topMargin: Style.barHeight * scaling property int topMargin: Style.barHeight * scaling
property color overlayColor: showOverlay ? Theme.overlay : "transparent" property color overlayColor: showOverlay ? Theme.overlay : "transparent"
function dismiss() { function hide() {
visible = false visible = false
} }
@ -33,7 +33,7 @@ PanelWindow {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: outerPanel.dismiss() onClicked: outerPanel.hide()
} }
Behavior on color { Behavior on color {

View file

@ -112,7 +112,7 @@ Window {
text: root.text text: root.text
color: Theme.textPrimary color: Theme.textPrimary
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pointSize: Style.fontSmall * scaling font.pointSize: Style.fontMedium * scaling
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap wrapMode: Text.Wrap

View file

@ -10,6 +10,7 @@ import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Widgets import Quickshell.Widgets
import qs.Modules.Bar import qs.Modules.Bar
import qs.Modules.DemoPanel
ShellRoot { ShellRoot {
id: root id: root
@ -21,4 +22,8 @@ ShellRoot {
modelData: item modelData: item
} }
} }
DemoPanel {
id: demoPanel
}
} }