From c3fd5aa9059f9795893a6739e6ff36d1e7be66f3 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 20 Mar 2026 23:42:36 +1100 Subject: [PATCH] chore: fix unqualified access --- components/controls/StyledScrollBar.qml | 16 ++-- components/controls/ToggleButton.qml | 6 +- components/filedialog/FolderContents.qml | 3 +- .../bar/components/workspaces/Workspace.qml | 5 +- modules/bar/popouts/kblayout/KbLayout.qml | 12 ++- .../bar/popouts/kblayout/KbLayoutModel.qml | 20 ++-- .../appearance/sections/AnimationsSection.qml | 6 +- .../appearance/sections/BackgroundSection.qml | 94 +++++++++---------- .../appearance/sections/BorderSection.qml | 12 +-- .../sections/ColorSchemeSection.qml | 18 ++-- .../sections/ColorVariantSection.qml | 14 +-- .../appearance/sections/FontsSection.qml | 42 +++++---- .../appearance/sections/ScalesSection.qml | 18 ++-- .../sections/TransparencySection.qml | 18 ++-- modules/controlcenter/audio/AudioPane.qml | 68 ++++++++------ .../components/ConnectedButtonGroup.qml | 16 ++-- .../components/WallpaperGrid.qml | 46 ++++----- .../controlcenter/launcher/LauncherPane.qml | 28 +++--- .../controlcenter/network/EthernetList.qml | 32 +++---- .../controlcenter/network/WirelessDetails.qml | 12 +-- .../controlcenter/network/WirelessList.qml | 42 +++++---- .../network/WirelessPasswordDialog.qml | 14 ++- modules/launcher/items/AppItem.qml | 2 +- modules/utilities/cards/Toggles.qml | 2 + modules/windowinfo/Buttons.qml | 2 + services/NotifData.qml | 2 + services/Players.qml | 6 +- 27 files changed, 297 insertions(+), 259 deletions(-) diff --git a/components/controls/StyledScrollBar.qml b/components/controls/StyledScrollBar.qml index 7ec537d0..bd7a7af0 100644 --- a/components/controls/StyledScrollBar.qml +++ b/components/controls/StyledScrollBar.qml @@ -81,20 +81,20 @@ ScrollBar { // Sync nonAnimPosition with flickable when not animating Connections { function onContentYChanged() { - if (!animating && !fullMouse.pressed) { - _updatingFromFlickable = true; - const contentHeight = flickable.contentHeight; - const height = flickable.height; + if (!root.animating && !fullMouse.pressed) { + root._updatingFromFlickable = true; + const contentHeight = root.flickable.contentHeight; + const height = root.flickable.height; if (contentHeight > height) { - nonAnimPosition = Math.max(0, Math.min(1, flickable.contentY / (contentHeight - height))); + root.nonAnimPosition = Math.max(0, Math.min(1, root.flickable.contentY / (contentHeight - height))); } else { - nonAnimPosition = 0; + root.nonAnimPosition = 0; } - _updatingFromFlickable = false; + root._updatingFromFlickable = false; } } - target: flickable + target: root.flickable } Connections { diff --git a/components/controls/ToggleButton.qml b/components/controls/ToggleButton.qml index 814a558c..c054db8b 100644 --- a/components/controls/ToggleButton.qml +++ b/components/controls/ToggleButton.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import ".." import qs.components import qs.components.controls @@ -33,8 +35,8 @@ StyledRect { Connections { function onContainsMouseChanged() { const newHovered = toggleStateLayer.containsMouse; - if (hovered !== newHovered) { - hovered = newHovered; + if (root.hovered !== newHovered) { + root.hovered = newHovered; } } diff --git a/components/filedialog/FolderContents.qml b/components/filedialog/FolderContents.qml index 44f4854e..58fe3fe1 100644 --- a/components/filedialog/FolderContents.qml +++ b/components/filedialog/FolderContents.qml @@ -5,6 +5,7 @@ import "../controls" import "../images" import qs.services import qs.config +import qs.utils import Caelestia.Models import Quickshell import QtQuick @@ -104,7 +105,7 @@ Item { model: FileSystemModel { path: { if (root.dialog.cwd[0] === "Home") - return `${Paths.home}/${root.dialog.cwd.slice(1).join("/")}`; + return Paths.home + `/${root.dialog.cwd.slice(1).join("/")}`; else return root.dialog.cwd.join("/"); } diff --git a/modules/bar/components/workspaces/Workspace.qml b/modules/bar/components/workspaces/Workspace.qml index 32efc125..7c35f96e 100644 --- a/modules/bar/components/workspaces/Workspace.qml +++ b/modules/bar/components/workspaces/Workspace.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import qs.components import qs.services import qs.utils @@ -90,7 +92,8 @@ ColumnLayout { Repeater { model: ScriptModel { values: { - const windows = Hypr.toplevels.values.filter(c => c.workspace?.id === root.ws); + const ws = root.ws; + const windows = Hypr.toplevels.values.filter(c => c.workspace?.id === ws); const maxIcons = Config.bar.workspaces.maxWindowIcons; return maxIcons > 0 ? windows.slice(0, maxIcons) : windows; } diff --git a/modules/bar/popouts/kblayout/KbLayout.qml b/modules/bar/popouts/kblayout/KbLayout.qml index d1b2d815..74ee67e1 100644 --- a/modules/bar/popouts/kblayout/KbLayout.qml +++ b/modules/bar/popouts/kblayout/KbLayout.qml @@ -85,6 +85,8 @@ ColumnLayout { } delegate: Item { + id: kbDelegate + required property int layoutIndex required property string label readonly property bool isDisabled: layoutIndex > 3 @@ -98,8 +100,8 @@ ColumnLayout { id: layer function onClicked(): void { - if (!isDisabled) - kb.switchTo(layoutIndex); + if (!kbDelegate.isDisabled) + kb.switchTo(kbDelegate.layoutIndex); } anchors.left: parent.left @@ -107,7 +109,7 @@ ColumnLayout { anchors.verticalCenter: parent.verticalCenter implicitHeight: parent.height - 4 radius: Appearance.rounding.full - enabled: !isDisabled + enabled: !kbDelegate.isDisabled } StyledText { @@ -118,9 +120,9 @@ ColumnLayout { anchors.right: layer.right anchors.leftMargin: Appearance.padding.small anchors.rightMargin: Appearance.padding.small - text: label + text: kbDelegate.label elide: Text.ElideRight - opacity: isDisabled ? 0.4 : 1.0 + opacity: kbDelegate.isDisabled ? 0.4 : 1.0 } } } diff --git a/modules/bar/popouts/kblayout/KbLayoutModel.qml b/modules/bar/popouts/kblayout/KbLayoutModel.qml index 213469aa..36032e29 100644 --- a/modules/bar/popouts/kblayout/KbLayoutModel.qml +++ b/modules/bar/popouts/kblayout/KbLayoutModel.qml @@ -137,9 +137,9 @@ Item { command: ["xmllint", "--xpath", "//layout/configItem[name and description]", "/usr/share/X11/xkb/rules/base.xml"] stdout: StdioCollector { - onStreamFinished: _buildXmlMap(text) + onStreamFinished: model._buildXmlMap(text) } - onRunningChanged: if (!running && (typeof exitCode !== "undefined") && exitCode !== 0) + onRunningChanged: if (!running && (typeof _xkbXmlBase.exitCode !== "undefined") && _xkbXmlBase.exitCode !== 0) _xkbXmlEvdev.running = true } @@ -148,7 +148,7 @@ Item { command: ["xmllint", "--xpath", "//layout/configItem[name and description]", "/usr/share/X11/xkb/rules/evdev.xml"] stdout: StdioCollector { - onStreamFinished: _buildXmlMap(text) + onStreamFinished: model._buildXmlMap(text) } } @@ -162,7 +162,7 @@ Item { const j = JSON.parse(text); const raw = (j?.str || j?.value || "").toString().trim(); if (raw.length) { - _setLayouts(raw); + model._setLayouts(raw); _fetchActiveLayouts.running = true; return; } @@ -183,7 +183,7 @@ Item { const kb = dev?.keyboards?.find(k => k.main) || dev?.keyboards?.[0]; const raw = (kb?.layout || "").trim(); if (raw.length) - _setLayouts(raw); + model._setLayouts(raw); } catch (e) {} _fetchActiveLayouts.running = true; } @@ -201,14 +201,14 @@ Item { const kb = dev?.keyboards?.find(k => k.main) || dev?.keyboards?.[0]; const idx = kb?.active_layout_index ?? -1; - activeIndex = idx >= 0 ? idx : -1; - activeLabel = (idx >= 0 && idx < _layoutsModel.count) ? _layoutsModel.get(idx).label : ""; + model.activeIndex = idx >= 0 ? idx : -1; + model.activeLabel = (idx >= 0 && idx < _layoutsModel.count) ? _layoutsModel.get(idx).label : ""; } catch (e) { - activeIndex = -1; - activeLabel = ""; + model.activeIndex = -1; + model.activeLabel = ""; } - _rebuildVisible(); + model._rebuildVisible(); } } } diff --git a/modules/controlcenter/appearance/sections/AnimationsSection.qml b/modules/controlcenter/appearance/sections/AnimationsSection.qml index 8fc8a5d2..f6f9b7a4 100644 --- a/modules/controlcenter/appearance/sections/AnimationsSection.qml +++ b/modules/controlcenter/appearance/sections/AnimationsSection.qml @@ -22,7 +22,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Animation duration scale") - value: rootPane.animDurationsScale + value: root.rootPane.animDurationsScale from: 0.1 to: 5.0 decimals: 1 @@ -33,8 +33,8 @@ CollapsibleSection { } onValueModified: newValue => { - rootPane.animDurationsScale = newValue; - rootPane.saveConfig(); + root.rootPane.animDurationsScale = newValue; + root.rootPane.saveConfig(); } } } diff --git a/modules/controlcenter/appearance/sections/BackgroundSection.qml b/modules/controlcenter/appearance/sections/BackgroundSection.qml index a3d09cd7..0488daac 100644 --- a/modules/controlcenter/appearance/sections/BackgroundSection.qml +++ b/modules/controlcenter/appearance/sections/BackgroundSection.qml @@ -17,19 +17,19 @@ CollapsibleSection { SwitchRow { label: qsTr("Background enabled") - checked: rootPane.backgroundEnabled + checked: root.rootPane.backgroundEnabled onToggled: checked => { - rootPane.backgroundEnabled = checked; - rootPane.saveConfig(); + root.rootPane.backgroundEnabled = checked; + root.rootPane.saveConfig(); } } SwitchRow { label: qsTr("Wallpaper enabled") - checked: rootPane.wallpaperEnabled + checked: root.rootPane.wallpaperEnabled onToggled: checked => { - rootPane.wallpaperEnabled = checked; - rootPane.saveConfig(); + root.rootPane.wallpaperEnabled = checked; + root.rootPane.saveConfig(); } } @@ -42,23 +42,23 @@ CollapsibleSection { SwitchRow { label: qsTr("Desktop Clock enabled") - checked: rootPane.desktopClockEnabled + checked: root.rootPane.desktopClockEnabled onToggled: checked => { - rootPane.desktopClockEnabled = checked; - rootPane.saveConfig(); + root.rootPane.desktopClockEnabled = checked; + root.rootPane.saveConfig(); } } SectionContainer { id: posContainer - readonly property var pos: (rootPane.desktopClockPosition || "top-left").split('-') + readonly property var pos: (root.rootPane.desktopClockPosition || "top-left").split('-') readonly property string currentV: pos[0] readonly property string currentH: pos[1] function updateClockPos(v, h) { - rootPane.desktopClockPosition = v + "-" + h; - rootPane.saveConfig(); + root.rootPane.desktopClockPosition = v + "-" + h; + root.rootPane.saveConfig(); } contentSpacing: Appearance.spacing.small @@ -72,7 +72,7 @@ CollapsibleSection { SplitButtonRow { label: qsTr("Vertical Position") - enabled: rootPane.desktopClockEnabled + enabled: root.rootPane.desktopClockEnabled menuItems: [ MenuItem { @@ -108,7 +108,7 @@ CollapsibleSection { SplitButtonRow { label: qsTr("Horizontal Position") - enabled: rootPane.desktopClockEnabled + enabled: root.rootPane.desktopClockEnabled expandedZ: 99 menuItems: [ @@ -145,10 +145,10 @@ CollapsibleSection { SwitchRow { label: qsTr("Invert colors") - checked: rootPane.desktopClockInvertColors + checked: root.rootPane.desktopClockInvertColors onToggled: checked => { - rootPane.desktopClockInvertColors = checked; - rootPane.saveConfig(); + root.rootPane.desktopClockInvertColors = checked; + root.rootPane.saveConfig(); } } @@ -163,10 +163,10 @@ CollapsibleSection { SwitchRow { label: qsTr("Enabled") - checked: rootPane.desktopClockShadowEnabled + checked: root.rootPane.desktopClockShadowEnabled onToggled: checked => { - rootPane.desktopClockShadowEnabled = checked; - rootPane.saveConfig(); + root.rootPane.desktopClockShadowEnabled = checked; + root.rootPane.saveConfig(); } } @@ -177,7 +177,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Opacity") - value: rootPane.desktopClockShadowOpacity * 100 + value: root.rootPane.desktopClockShadowOpacity * 100 from: 0 to: 100 suffix: "%" @@ -189,8 +189,8 @@ CollapsibleSection { parseValueFunction: text => parseInt(text) onValueModified: newValue => { - rootPane.desktopClockShadowOpacity = newValue / 100; - rootPane.saveConfig(); + root.rootPane.desktopClockShadowOpacity = newValue / 100; + root.rootPane.saveConfig(); } } } @@ -202,7 +202,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Blur") - value: rootPane.desktopClockShadowBlur * 100 + value: root.rootPane.desktopClockShadowBlur * 100 from: 0 to: 100 suffix: "%" @@ -214,8 +214,8 @@ CollapsibleSection { parseValueFunction: text => parseInt(text) onValueModified: newValue => { - rootPane.desktopClockShadowBlur = newValue / 100; - rootPane.saveConfig(); + root.rootPane.desktopClockShadowBlur = newValue / 100; + root.rootPane.saveConfig(); } } } @@ -232,19 +232,19 @@ CollapsibleSection { SwitchRow { label: qsTr("Enabled") - checked: rootPane.desktopClockBackgroundEnabled + checked: root.rootPane.desktopClockBackgroundEnabled onToggled: checked => { - rootPane.desktopClockBackgroundEnabled = checked; - rootPane.saveConfig(); + root.rootPane.desktopClockBackgroundEnabled = checked; + root.rootPane.saveConfig(); } } SwitchRow { label: qsTr("Blur enabled") - checked: rootPane.desktopClockBackgroundBlur + checked: root.rootPane.desktopClockBackgroundBlur onToggled: checked => { - rootPane.desktopClockBackgroundBlur = checked; - rootPane.saveConfig(); + root.rootPane.desktopClockBackgroundBlur = checked; + root.rootPane.saveConfig(); } } @@ -255,7 +255,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Opacity") - value: rootPane.desktopClockBackgroundOpacity * 100 + value: root.rootPane.desktopClockBackgroundOpacity * 100 from: 0 to: 100 suffix: "%" @@ -267,8 +267,8 @@ CollapsibleSection { parseValueFunction: text => parseInt(text) onValueModified: newValue => { - rootPane.desktopClockBackgroundOpacity = newValue / 100; - rootPane.saveConfig(); + root.rootPane.desktopClockBackgroundOpacity = newValue / 100; + root.rootPane.saveConfig(); } } } @@ -283,19 +283,19 @@ CollapsibleSection { SwitchRow { label: qsTr("Visualiser enabled") - checked: rootPane.visualiserEnabled + checked: root.rootPane.visualiserEnabled onToggled: checked => { - rootPane.visualiserEnabled = checked; - rootPane.saveConfig(); + root.rootPane.visualiserEnabled = checked; + root.rootPane.saveConfig(); } } SwitchRow { label: qsTr("Visualiser auto hide") - checked: rootPane.visualiserAutoHide + checked: root.rootPane.visualiserAutoHide onToggled: checked => { - rootPane.visualiserAutoHide = checked; - rootPane.saveConfig(); + root.rootPane.visualiserAutoHide = checked; + root.rootPane.saveConfig(); } } @@ -306,7 +306,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Visualiser rounding") - value: rootPane.visualiserRounding + value: root.rootPane.visualiserRounding from: 0 to: 10 stepSize: 1 @@ -318,8 +318,8 @@ CollapsibleSection { parseValueFunction: text => parseInt(text) onValueModified: newValue => { - rootPane.visualiserRounding = Math.round(newValue); - rootPane.saveConfig(); + root.rootPane.visualiserRounding = Math.round(newValue); + root.rootPane.saveConfig(); } } } @@ -331,7 +331,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Visualiser spacing") - value: rootPane.visualiserSpacing + value: root.rootPane.visualiserSpacing from: 0 to: 2 validator: DoubleValidator { @@ -340,8 +340,8 @@ CollapsibleSection { } onValueModified: newValue => { - rootPane.visualiserSpacing = newValue; - rootPane.saveConfig(); + root.rootPane.visualiserSpacing = newValue; + root.rootPane.saveConfig(); } } } diff --git a/modules/controlcenter/appearance/sections/BorderSection.qml b/modules/controlcenter/appearance/sections/BorderSection.qml index 5df0bc75..167c3f14 100644 --- a/modules/controlcenter/appearance/sections/BorderSection.qml +++ b/modules/controlcenter/appearance/sections/BorderSection.qml @@ -22,7 +22,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Border rounding") - value: rootPane.borderRounding + value: root.rootPane.borderRounding from: 0.1 to: 100 decimals: 1 @@ -33,8 +33,8 @@ CollapsibleSection { } onValueModified: newValue => { - rootPane.borderRounding = newValue; - rootPane.saveConfig(); + root.rootPane.borderRounding = newValue; + root.rootPane.saveConfig(); } } } @@ -46,7 +46,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Border thickness") - value: rootPane.borderThickness + value: root.rootPane.borderThickness from: 0 to: 100 decimals: 1 @@ -57,8 +57,8 @@ CollapsibleSection { } onValueModified: newValue => { - rootPane.borderThickness = newValue; - rootPane.saveConfig(); + root.rootPane.borderThickness = newValue; + root.rootPane.saveConfig(); } } } diff --git a/modules/controlcenter/appearance/sections/ColorSchemeSection.qml b/modules/controlcenter/appearance/sections/ColorSchemeSection.qml index ef18fc93..98cbe906 100644 --- a/modules/controlcenter/appearance/sections/ColorSchemeSection.qml +++ b/modules/controlcenter/appearance/sections/ColorSchemeSection.qml @@ -22,6 +22,8 @@ CollapsibleSection { model: Schemes.list delegate: StyledRect { + id: schemeDelegate + required property var modelData Layout.fillWidth: true @@ -36,8 +38,8 @@ CollapsibleSection { StateLayer { function onClicked(): void { - const name = modelData.name; - const flavour = modelData.flavour; + const name = schemeDelegate.modelData.name; + const flavour = schemeDelegate.modelData.flavour; const schemeKey = `${name} ${flavour}`; Schemes.currentScheme = schemeKey; @@ -72,9 +74,9 @@ CollapsibleSection { Layout.alignment: Qt.AlignVCenter border.width: 1 - border.color: Qt.alpha(`#${modelData.colours?.outline}`, 0.5) + border.color: Qt.alpha(`#${schemeDelegate.modelData.colours?.outline}`, 0.5) - color: `#${modelData.colours?.surface}` + color: `#${schemeDelegate.modelData.colours?.surface}` radius: Appearance.rounding.full implicitWidth: iconPlaceholder.implicitWidth implicitHeight: iconPlaceholder.implicitWidth @@ -101,7 +103,7 @@ CollapsibleSection { anchors.right: parent.right implicitWidth: preview.implicitWidth - color: `#${modelData.colours?.primary}` + color: `#${schemeDelegate.modelData.colours?.primary}` radius: Appearance.rounding.full } } @@ -112,12 +114,12 @@ CollapsibleSection { spacing: 0 StyledText { - text: modelData.flavour ?? "" + text: schemeDelegate.modelData.flavour ?? "" font.pointSize: Appearance.font.size.normal } StyledText { - text: modelData.name ?? "" + text: schemeDelegate.modelData.name ?? "" font.pointSize: Appearance.font.size.small color: Colours.palette.m3outline @@ -129,7 +131,7 @@ CollapsibleSection { Loader { asynchronous: true - active: isCurrent + active: schemeDelegate.isCurrent sourceComponent: MaterialIcon { text: "check" diff --git a/modules/controlcenter/appearance/sections/ColorVariantSection.qml b/modules/controlcenter/appearance/sections/ColorVariantSection.qml index 62fd1354..afbf9b29 100644 --- a/modules/controlcenter/appearance/sections/ColorVariantSection.qml +++ b/modules/controlcenter/appearance/sections/ColorVariantSection.qml @@ -22,6 +22,8 @@ CollapsibleSection { model: M3Variants.list delegate: StyledRect { + id: variantDelegate + required property var modelData Layout.fillWidth: true @@ -33,7 +35,7 @@ CollapsibleSection { StateLayer { function onClicked(): void { - const variant = modelData.variant; + const variant = variantDelegate.modelData.variant; Schemes.currentVariant = variant; Quickshell.execDetached(["caelestia", "scheme", "set", "-v", variant]); @@ -64,19 +66,19 @@ CollapsibleSection { spacing: Appearance.spacing.normal MaterialIcon { - text: modelData.icon + text: variantDelegate.modelData.icon font.pointSize: Appearance.font.size.large - fill: modelData.variant === Schemes.currentVariant ? 1 : 0 + fill: variantDelegate.modelData.variant === Schemes.currentVariant ? 1 : 0 } StyledText { Layout.fillWidth: true - text: modelData.name - font.weight: modelData.variant === Schemes.currentVariant ? 500 : 400 + text: variantDelegate.modelData.name + font.weight: variantDelegate.modelData.variant === Schemes.currentVariant ? 500 : 400 } MaterialIcon { - visible: modelData.variant === Schemes.currentVariant + visible: variantDelegate.modelData.variant === Schemes.currentVariant text: "check" color: Colours.palette.m3primary font.pointSize: Appearance.font.size.large diff --git a/modules/controlcenter/appearance/sections/FontsSection.qml b/modules/controlcenter/appearance/sections/FontsSection.qml index 5bee6bbd..fb44f1a6 100644 --- a/modules/controlcenter/appearance/sections/FontsSection.qml +++ b/modules/controlcenter/appearance/sections/FontsSection.qml @@ -45,9 +45,11 @@ CollapsibleSection { } delegate: StyledRect { + id: sansDelegate + required property string modelData required property int index - readonly property bool isCurrent: modelData === rootPane.fontFamilySans + readonly property bool isCurrent: modelData === root.rootPane.fontFamilySans width: ListView.view.width color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) @@ -57,8 +59,8 @@ CollapsibleSection { StateLayer { function onClicked(): void { - rootPane.fontFamilySans = modelData; - rootPane.saveConfig(); + root.rootPane.fontFamilySans = sansDelegate.modelData; + root.rootPane.saveConfig(); } } @@ -73,7 +75,7 @@ CollapsibleSection { spacing: Appearance.spacing.normal StyledText { - text: modelData + text: sansDelegate.modelData font.pointSize: Appearance.font.size.normal } @@ -83,7 +85,7 @@ CollapsibleSection { Loader { asynchronous: true - active: isCurrent + active: sansDelegate.isCurrent sourceComponent: MaterialIcon { text: "check" @@ -127,9 +129,11 @@ CollapsibleSection { } delegate: StyledRect { + id: monoDelegate + required property string modelData required property int index - readonly property bool isCurrent: modelData === rootPane.fontFamilyMono + readonly property bool isCurrent: modelData === root.rootPane.fontFamilyMono width: ListView.view.width color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) @@ -139,8 +143,8 @@ CollapsibleSection { StateLayer { function onClicked(): void { - rootPane.fontFamilyMono = modelData; - rootPane.saveConfig(); + root.rootPane.fontFamilyMono = monoDelegate.modelData; + root.rootPane.saveConfig(); } } @@ -155,7 +159,7 @@ CollapsibleSection { spacing: Appearance.spacing.normal StyledText { - text: modelData + text: monoDelegate.modelData font.pointSize: Appearance.font.size.normal } @@ -165,7 +169,7 @@ CollapsibleSection { Loader { asynchronous: true - active: isCurrent + active: monoDelegate.isCurrent sourceComponent: MaterialIcon { text: "check" @@ -211,9 +215,11 @@ CollapsibleSection { } delegate: StyledRect { + id: materialDelegate + required property string modelData required property int index - readonly property bool isCurrent: modelData === rootPane.fontFamilyMaterial + readonly property bool isCurrent: modelData === root.rootPane.fontFamilyMaterial width: ListView.view.width color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) @@ -223,8 +229,8 @@ CollapsibleSection { StateLayer { function onClicked(): void { - rootPane.fontFamilyMaterial = modelData; - rootPane.saveConfig(); + root.rootPane.fontFamilyMaterial = materialDelegate.modelData; + root.rootPane.saveConfig(); } } @@ -239,7 +245,7 @@ CollapsibleSection { spacing: Appearance.spacing.normal StyledText { - text: modelData + text: materialDelegate.modelData font.pointSize: Appearance.font.size.normal } @@ -249,7 +255,7 @@ CollapsibleSection { Loader { asynchronous: true - active: isCurrent + active: materialDelegate.isCurrent sourceComponent: MaterialIcon { text: "check" @@ -272,7 +278,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Font size scale") - value: rootPane.fontSizeScale + value: root.rootPane.fontSizeScale from: 0.7 to: 1.5 decimals: 2 @@ -283,8 +289,8 @@ CollapsibleSection { } onValueModified: newValue => { - rootPane.fontSizeScale = newValue; - rootPane.saveConfig(); + root.rootPane.fontSizeScale = newValue; + root.rootPane.saveConfig(); } } } diff --git a/modules/controlcenter/appearance/sections/ScalesSection.qml b/modules/controlcenter/appearance/sections/ScalesSection.qml index b7c71dd6..b6f6a409 100644 --- a/modules/controlcenter/appearance/sections/ScalesSection.qml +++ b/modules/controlcenter/appearance/sections/ScalesSection.qml @@ -22,7 +22,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Padding scale") - value: rootPane.paddingScale + value: root.rootPane.paddingScale from: 0.5 to: 2.0 decimals: 1 @@ -33,8 +33,8 @@ CollapsibleSection { } onValueModified: newValue => { - rootPane.paddingScale = newValue; - rootPane.saveConfig(); + root.rootPane.paddingScale = newValue; + root.rootPane.saveConfig(); } } } @@ -46,7 +46,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Rounding scale") - value: rootPane.roundingScale + value: root.rootPane.roundingScale from: 0.1 to: 5.0 decimals: 1 @@ -57,8 +57,8 @@ CollapsibleSection { } onValueModified: newValue => { - rootPane.roundingScale = newValue; - rootPane.saveConfig(); + root.rootPane.roundingScale = newValue; + root.rootPane.saveConfig(); } } } @@ -70,7 +70,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Spacing scale") - value: rootPane.spacingScale + value: root.rootPane.spacingScale from: 0.1 to: 2.0 decimals: 1 @@ -81,8 +81,8 @@ CollapsibleSection { } onValueModified: newValue => { - rootPane.spacingScale = newValue; - rootPane.saveConfig(); + root.rootPane.spacingScale = newValue; + root.rootPane.saveConfig(); } } } diff --git a/modules/controlcenter/appearance/sections/TransparencySection.qml b/modules/controlcenter/appearance/sections/TransparencySection.qml index 89b65c55..7a29ec4b 100644 --- a/modules/controlcenter/appearance/sections/TransparencySection.qml +++ b/modules/controlcenter/appearance/sections/TransparencySection.qml @@ -17,10 +17,10 @@ CollapsibleSection { SwitchRow { label: qsTr("Transparency enabled") - checked: rootPane.transparencyEnabled + checked: root.rootPane.transparencyEnabled onToggled: checked => { - rootPane.transparencyEnabled = checked; - rootPane.saveConfig(); + root.rootPane.transparencyEnabled = checked; + root.rootPane.saveConfig(); } } @@ -31,7 +31,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Transparency base") - value: rootPane.transparencyBase * 100 + value: root.rootPane.transparencyBase * 100 from: 0 to: 100 suffix: "%" @@ -43,8 +43,8 @@ CollapsibleSection { parseValueFunction: text => parseInt(text) onValueModified: newValue => { - rootPane.transparencyBase = newValue / 100; - rootPane.saveConfig(); + root.rootPane.transparencyBase = newValue / 100; + root.rootPane.saveConfig(); } } } @@ -56,7 +56,7 @@ CollapsibleSection { Layout.fillWidth: true label: qsTr("Transparency layers") - value: rootPane.transparencyLayers * 100 + value: root.rootPane.transparencyLayers * 100 from: 0 to: 100 suffix: "%" @@ -68,8 +68,8 @@ CollapsibleSection { parseValueFunction: text => parseInt(text) onValueModified: newValue => { - rootPane.transparencyLayers = newValue / 100; - rootPane.saveConfig(); + root.rootPane.transparencyLayers = newValue / 100; + root.rootPane.saveConfig(); } } } diff --git a/modules/controlcenter/audio/AudioPane.qml b/modules/controlcenter/audio/AudioPane.qml index 32c018c1..28f82fc9 100644 --- a/modules/controlcenter/audio/AudioPane.qml +++ b/modules/controlcenter/audio/AudioPane.qml @@ -86,16 +86,18 @@ Item { model: Audio.sinks delegate: StyledRect { + id: outputDeviceDelegate + required property var modelData Layout.fillWidth: true - color: Audio.sink?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" + color: Audio.sink?.id === outputDeviceDelegate.modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" radius: Appearance.rounding.normal StateLayer { function onClicked(): void { - Audio.setAudioSink(modelData); + Audio.setAudioSink(outputDeviceDelegate.modelData); } } @@ -110,9 +112,9 @@ Item { spacing: Appearance.spacing.normal MaterialIcon { - text: Audio.sink?.id === modelData.id ? "speaker" : "speaker_group" + text: Audio.sink?.id === outputDeviceDelegate.modelData.id ? "speaker" : "speaker_group" font.pointSize: Appearance.font.size.large - fill: Audio.sink?.id === modelData.id ? 1 : 0 + fill: Audio.sink?.id === outputDeviceDelegate.modelData.id ? 1 : 0 } StyledText { @@ -120,8 +122,8 @@ Item { elide: Text.ElideRight maximumLineCount: 1 - text: modelData.description || qsTr("Unknown") - font.weight: Audio.sink?.id === modelData.id ? 500 : 400 + text: outputDeviceDelegate.modelData.description || qsTr("Unknown") + font.weight: Audio.sink?.id === outputDeviceDelegate.modelData.id ? 500 : 400 } } @@ -164,16 +166,18 @@ Item { model: Audio.sources delegate: StyledRect { + id: inputDeviceDelegate + required property var modelData Layout.fillWidth: true - color: Audio.source?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" + color: Audio.source?.id === inputDeviceDelegate.modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" radius: Appearance.rounding.normal StateLayer { function onClicked(): void { - Audio.setAudioSource(modelData); + Audio.setAudioSource(inputDeviceDelegate.modelData); } } @@ -190,7 +194,7 @@ Item { MaterialIcon { text: "mic" font.pointSize: Appearance.font.size.large - fill: Audio.source?.id === modelData.id ? 1 : 0 + fill: Audio.source?.id === inputDeviceDelegate.modelData.id ? 1 : 0 } StyledText { @@ -198,8 +202,8 @@ Item { elide: Text.ElideRight maximumLineCount: 1 - text: modelData.description || qsTr("Unknown") - font.weight: Audio.source?.id === modelData.id ? 500 : 400 + text: inputDeviceDelegate.modelData.description || qsTr("Unknown") + font.weight: Audio.source?.id === inputDeviceDelegate.modelData.id ? 500 : 400 } } @@ -489,6 +493,8 @@ Item { Layout.fillWidth: true delegate: ColumnLayout { + id: streamDelegate + required property var modelData required property int index @@ -509,7 +515,7 @@ Item { Layout.fillWidth: true elide: Text.ElideRight maximumLineCount: 1 - text: Audio.getStreamName(modelData) + text: Audio.getStreamName(streamDelegate.modelData) font.pointSize: Appearance.font.size.normal font.weight: 500 } @@ -522,27 +528,27 @@ Item { bottom: 0 top: 100 } - enabled: !Audio.getStreamMuted(modelData) + enabled: !Audio.getStreamMuted(streamDelegate.modelData) Component.onCompleted: { - text = Math.round(Audio.getStreamVolume(modelData) * 100).toString(); + text = Math.round(Audio.getStreamVolume(streamDelegate.modelData) * 100).toString(); } Connections { function onAudioChanged() { - if (!streamVolumeInput.hasFocus && modelData?.audio) { - streamVolumeInput.text = Math.round(modelData.audio.volume * 100).toString(); + if (!streamVolumeInput.hasFocus && streamDelegate.modelData?.audio) { + streamVolumeInput.text = Math.round(streamDelegate.modelData.audio.volume * 100).toString(); } } - target: modelData + target: streamDelegate.modelData } onTextEdited: text => { if (hasFocus) { const val = parseInt(text); if (!isNaN(val) && val >= 0 && val <= 100) { - Audio.setStreamVolume(modelData, val / 100); + Audio.setStreamVolume(streamDelegate.modelData, val / 100); } } } @@ -550,7 +556,7 @@ Item { onEditingFinished: { const val = parseInt(text); if (isNaN(val) || val < 0 || val > 100) { - text = Math.round(Audio.getStreamVolume(modelData) * 100).toString(); + text = Math.round(Audio.getStreamVolume(streamDelegate.modelData) * 100).toString(); } } } @@ -559,7 +565,7 @@ Item { text: "%" color: Colours.palette.m3outline font.pointSize: Appearance.font.size.normal - opacity: Audio.getStreamMuted(modelData) ? 0.5 : 1 + opacity: Audio.getStreamMuted(streamDelegate.modelData) ? 0.5 : 1 } StyledRect { @@ -567,11 +573,11 @@ Item { implicitHeight: streamMuteIcon.implicitHeight + Appearance.padding.normal * 2 radius: Appearance.rounding.normal - color: Audio.getStreamMuted(modelData) ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer + color: Audio.getStreamMuted(streamDelegate.modelData) ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer StateLayer { function onClicked(): void { - Audio.setStreamMuted(modelData, !Audio.getStreamMuted(modelData)); + Audio.setStreamMuted(streamDelegate.modelData, !Audio.getStreamMuted(streamDelegate.modelData)); } } @@ -579,21 +585,23 @@ Item { id: streamMuteIcon anchors.centerIn: parent - text: Audio.getStreamMuted(modelData) ? "volume_off" : "volume_up" - color: Audio.getStreamMuted(modelData) ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer + text: Audio.getStreamMuted(streamDelegate.modelData) ? "volume_off" : "volume_up" + color: Audio.getStreamMuted(streamDelegate.modelData) ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer } } } StyledSlider { + id: streamSlider + Layout.fillWidth: true implicitHeight: Appearance.padding.normal * 3 - value: Audio.getStreamVolume(modelData) - enabled: !Audio.getStreamMuted(modelData) + value: Audio.getStreamVolume(streamDelegate.modelData) + enabled: !Audio.getStreamMuted(streamDelegate.modelData) opacity: enabled ? 1 : 0.5 onMoved: { - Audio.setStreamVolume(modelData, value); + Audio.setStreamVolume(streamDelegate.modelData, value); if (!streamVolumeInput.hasFocus) { streamVolumeInput.text = Math.round(value * 100).toString(); } @@ -601,12 +609,12 @@ Item { Connections { function onAudioChanged() { - if (modelData?.audio) { - value = modelData.audio.volume; + if (streamDelegate.modelData?.audio) { + streamSlider.value = streamDelegate.modelData.audio.volume; } } - target: modelData + target: streamDelegate.modelData } } } diff --git a/modules/controlcenter/components/ConnectedButtonGroup.qml b/modules/controlcenter/components/ConnectedButtonGroup.qml index d3dfb291..c4398ebc 100644 --- a/modules/controlcenter/components/ConnectedButtonGroup.qml +++ b/modules/controlcenter/components/ConnectedButtonGroup.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import qs.components import qs.components.controls import qs.services @@ -66,10 +68,10 @@ StyledRect { // Create binding in Component.onCompleted Component.onCompleted: { - if (modelData.state !== undefined && modelData.state) { - _checked = modelData.state; - } else if (root.rootItem && modelData.propertyName) { - const propName = modelData.propertyName; + if (button.modelData.state !== undefined && button.modelData.state) { + _checked = button.modelData.state; + } else if (root.rootItem && button.modelData.propertyName) { + const propName = button.modelData.propertyName; const rootItem = root.rootItem; _checked = Qt.binding(function () { return rootItem[propName] ?? false; @@ -88,9 +90,9 @@ StyledRect { Layout.preferredWidth: implicitWidth + (stateLayer.pressed ? Appearance.padding.large : internalChecked ? Appearance.padding.smaller : 0) onClicked: { - if (modelData.onToggled && root.rootItem && modelData.propertyName) { - const currentValue = root.rootItem[modelData.propertyName] ?? false; - modelData.onToggled(!currentValue); + if (button.modelData.onToggled && root.rootItem && button.modelData.propertyName) { + const currentValue = root.rootItem[button.modelData.propertyName] ?? false; + button.modelData.onToggled(!currentValue); } } diff --git a/modules/controlcenter/components/WallpaperGrid.qml b/modules/controlcenter/components/WallpaperGrid.qml index a6db661b..85114004 100644 --- a/modules/controlcenter/components/WallpaperGrid.qml +++ b/modules/controlcenter/components/WallpaperGrid.qml @@ -28,6 +28,8 @@ GridView { } delegate: Item { + id: wpDelegate + required property var modelData required property int index readonly property bool isCurrent: modelData && modelData.path === Wallpapers.actualCurrent @@ -39,27 +41,27 @@ GridView { StateLayer { function onClicked(): void { - Wallpapers.setWallpaper(modelData.path); + Wallpapers.setWallpaper(wpDelegate.modelData.path); } anchors.fill: parent - anchors.leftMargin: itemMargin - anchors.rightMargin: itemMargin - anchors.topMargin: itemMargin - anchors.bottomMargin: itemMargin - radius: itemRadius + anchors.leftMargin: wpDelegate.itemMargin + anchors.rightMargin: wpDelegate.itemMargin + anchors.topMargin: wpDelegate.itemMargin + anchors.bottomMargin: wpDelegate.itemMargin + radius: wpDelegate.itemRadius } StyledClippingRect { id: image anchors.fill: parent - anchors.leftMargin: itemMargin - anchors.rightMargin: itemMargin - anchors.topMargin: itemMargin - anchors.bottomMargin: itemMargin + anchors.leftMargin: wpDelegate.itemMargin + anchors.rightMargin: wpDelegate.itemMargin + anchors.topMargin: wpDelegate.itemMargin + anchors.bottomMargin: wpDelegate.itemMargin color: Colours.tPalette.m3surfaceContainer - radius: itemRadius + radius: wpDelegate.itemRadius antialiasing: true layer.enabled: true layer.smooth: true @@ -67,7 +69,7 @@ GridView { CachingImage { id: cachingImage - path: modelData.path + path: wpDelegate.modelData.path anchors.fill: parent fillMode: Image.PreserveAspectCrop cache: true @@ -91,7 +93,7 @@ GridView { id: fallbackImage anchors.fill: parent - source: fallbackTimer.triggered && cachingImage.status !== Image.Ready ? modelData.path : "" + source: fallbackTimer.triggered && cachingImage.status !== Image.Ready ? wpDelegate.modelData.path : "" asynchronous: true fillMode: Image.PreserveAspectCrop cache: true @@ -167,13 +169,13 @@ GridView { Rectangle { anchors.fill: parent - anchors.leftMargin: itemMargin - anchors.rightMargin: itemMargin - anchors.topMargin: itemMargin - anchors.bottomMargin: itemMargin + anchors.leftMargin: wpDelegate.itemMargin + anchors.rightMargin: wpDelegate.itemMargin + anchors.topMargin: wpDelegate.itemMargin + anchors.bottomMargin: wpDelegate.itemMargin color: "transparent" - radius: itemRadius + border.width - border.width: isCurrent ? 2 : 0 + radius: wpDelegate.itemRadius + border.width + border.width: wpDelegate.isCurrent ? 2 : 0 border.color: Colours.palette.m3primary antialiasing: true smooth: true @@ -190,7 +192,7 @@ GridView { anchors.top: parent.top anchors.margins: Appearance.padding.small - visible: isCurrent + visible: wpDelegate.isCurrent text: "check_circle" color: Colours.palette.m3primary font.pointSize: Appearance.font.size.large @@ -207,10 +209,10 @@ GridView { anchors.rightMargin: Appearance.padding.normal + Appearance.spacing.normal / 2 anchors.bottomMargin: Appearance.padding.normal - text: modelData.name + text: wpDelegate.modelData.name font.pointSize: Appearance.font.size.smaller font.weight: 500 - color: isCurrent ? Colours.palette.m3primary : Colours.palette.m3onSurface + color: wpDelegate.isCurrent ? Colours.palette.m3primary : Colours.palette.m3onSurface elide: Text.ElideMiddle maximumLineCount: 1 horizontalAlignment: Text.AlignHCenter diff --git a/modules/controlcenter/launcher/LauncherPane.qml b/modules/controlcenter/launcher/LauncherPane.qml index 7444b102..7f82457c 100644 --- a/modules/controlcenter/launcher/LauncherPane.qml +++ b/modules/controlcenter/launcher/LauncherPane.qml @@ -102,7 +102,7 @@ Item { anchors.fill: parent onSelectedAppChanged: { - root.session.launcher.active = root.selectedApp; + session.launcher.active = selectedApp; updateToggleState(); } @@ -117,7 +117,7 @@ Item { Connections { function onActiveChanged() { root.selectedApp = root.session.launcher.active; - updateToggleState(); + root.updateToggleState(); } target: root.session.launcher @@ -133,7 +133,7 @@ Item { Connections { function onAppsChanged() { - updateFilteredApps(); + root.updateFilteredApps(); } target: allAppsDb @@ -299,10 +299,12 @@ Item { clip: true StyledScrollBar.vertical: StyledScrollBar { - flickable: parent + flickable: appsListView } delegate: StyledRect { + id: appDelegate + required property var modelData readonly property bool isSelected: root.selectedApp === modelData @@ -328,7 +330,7 @@ Item { StateLayer { function onClicked(): void { - root.session.launcher.active = modelData; + root.session.launcher.active = appDelegate.modelData; } } @@ -345,20 +347,20 @@ Item { Layout.alignment: Qt.AlignVCenter implicitSize: 32 source: { - const entry = modelData.entry; + const entry = appDelegate.modelData.entry; return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; } } StyledText { Layout.fillWidth: true - text: modelData.name || modelData.entry?.name || qsTr("Unknown") + text: appDelegate.modelData.name || appDelegate.modelData.entry?.name || qsTr("Unknown") font.pointSize: Appearance.font.size.normal } Loader { - readonly property bool isHidden: modelData ? Strings.testRegexList(Config.launcher.hiddenApps, modelData.id) : false - readonly property bool isFav: modelData ? Strings.testRegexList(Config.launcher.favouriteApps, modelData.id) : false + readonly property bool isHidden: appDelegate.modelData ? Strings.testRegexList(Config.launcher.hiddenApps, appDelegate.modelData.id) : false + readonly property bool isFav: appDelegate.modelData ? Strings.testRegexList(Config.launcher.favouriteApps, appDelegate.modelData.id) : false Layout.alignment: Qt.AlignVCenter asynchronous: true @@ -513,7 +515,7 @@ Item { ColumnLayout { id: appDetailsLayout - readonly property var displayedApp: parent && parent.displayedApp !== undefined ? parent.displayedApp : null + readonly property var displayedApp: parent?.displayedApp ?? null // qmllint disable missing-property anchors.fill: parent spacing: Appearance.spacing.normal @@ -522,7 +524,7 @@ Item { Layout.leftMargin: Appearance.padding.large * 2 Layout.rightMargin: Appearance.padding.large * 2 Layout.topMargin: Appearance.padding.large * 2 - visible: displayedApp === null + visible: appDetailsLayout.displayedApp === null icon: "apps" title: qsTr("Launcher Applications") } @@ -532,7 +534,7 @@ Item { Layout.leftMargin: Appearance.padding.large * 2 Layout.rightMargin: Appearance.padding.large * 2 Layout.topMargin: Appearance.padding.large * 2 - visible: displayedApp !== null + visible: appDetailsLayout.displayedApp !== null implicitWidth: Math.max(appIconImage.implicitWidth, appTitleText.implicitWidth) implicitHeight: appIconImage.implicitHeight + Appearance.spacing.normal + appTitleText.implicitHeight @@ -562,7 +564,7 @@ Item { id: appTitleText Layout.alignment: Qt.AlignHCenter - text: displayedApp ? (displayedApp.name || displayedApp.entry?.name || qsTr("Application Details")) : "" + text: appDetailsLayout.displayedApp.displayedApp ? (appDetailsLayout.displayedApp.displayedApp.displayedApp.name || appDetailsLayout.displayedApp.displayedApp.displayedApp.entry?.name || qsTr("Application Details")) : "" font.pointSize: Appearance.font.size.large font.bold: true } diff --git a/modules/controlcenter/network/EthernetList.qml b/modules/controlcenter/network/EthernetList.qml index 256f02d5..e9f24168 100644 --- a/modules/controlcenter/network/EthernetList.qml +++ b/modules/controlcenter/network/EthernetList.qml @@ -70,7 +70,7 @@ DeviceList { id: stateLayer function onClicked(): void { - root.session.ethernet.active = modelData; + root.session.ethernet.active = ethernetItem.modelData; } } @@ -87,12 +87,12 @@ DeviceList { implicitHeight: icon.implicitHeight + Appearance.padding.normal * 2 radius: Appearance.rounding.normal - color: modelData.connected ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh + color: ethernetItem.modelData.connected ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh StyledRect { anchors.fill: parent radius: parent.radius - color: Qt.alpha(modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface, stateLayer.pressed ? 0.1 : stateLayer.containsMouse ? 0.08 : 0) + color: Qt.alpha(ethernetItem.modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface, stateLayer.pressed ? 0.1 : stateLayer.containsMouse ? 0.08 : 0) } MaterialIcon { @@ -101,8 +101,8 @@ DeviceList { anchors.centerIn: parent text: "cable" font.pointSize: Appearance.font.size.large - fill: modelData.connected ? 1 : 0 - color: modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface + fill: ethernetItem.modelData.connected ? 1 : 0 + color: ethernetItem.modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface Behavior on fill { Anim {} @@ -117,7 +117,7 @@ DeviceList { StyledText { Layout.fillWidth: true - text: modelData.interface || qsTr("Unknown") + text: ethernetItem.modelData.interface || qsTr("Unknown") elide: Text.ElideRight } @@ -127,10 +127,10 @@ DeviceList { StyledText { Layout.fillWidth: true - text: modelData.connected ? qsTr("Connected") : qsTr("Disconnected") - color: modelData.connected ? Colours.palette.m3primary : Colours.palette.m3outline + text: ethernetItem.modelData.connected ? qsTr("Connected") : qsTr("Disconnected") + color: ethernetItem.modelData.connected ? Colours.palette.m3primary : Colours.palette.m3outline font.pointSize: Appearance.font.size.small - font.weight: modelData.connected ? 500 : 400 + font.weight: ethernetItem.modelData.connected ? 500 : 400 elide: Text.ElideRight } } @@ -143,18 +143,18 @@ DeviceList { implicitHeight: connectIcon.implicitHeight + Appearance.padding.smaller * 2 radius: Appearance.rounding.full - color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.connected ? 1 : 0) + color: Qt.alpha(Colours.palette.m3primaryContainer, ethernetItem.modelData.connected ? 1 : 0) StateLayer { function onClicked(): void { - if (modelData.connected && modelData.connection) { - Nmcli.disconnectEthernet(modelData.connection, () => {}); + if (ethernetItem.modelData.connected && ethernetItem.modelData.connection) { + Nmcli.disconnectEthernet(ethernetItem.modelData.connection, () => {}); } else { - Nmcli.connectEthernet(modelData.connection || "", modelData.interface || "", () => {}); + Nmcli.connectEthernet(ethernetItem.modelData.connection || "", ethernetItem.modelData.interface || "", () => {}); } } - color: modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface + color: ethernetItem.modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface } MaterialIcon { @@ -162,8 +162,8 @@ DeviceList { anchors.centerIn: parent animate: true - text: modelData.connected ? "link_off" : "link" - color: modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface + text: ethernetItem.modelData.connected ? "link_off" : "link" + color: ethernetItem.modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface } } } diff --git a/modules/controlcenter/network/WirelessDetails.qml b/modules/controlcenter/network/WirelessDetails.qml index 3ed54abd..67d7f065 100644 --- a/modules/controlcenter/network/WirelessDetails.qml +++ b/modules/controlcenter/network/WirelessDetails.qml @@ -170,11 +170,11 @@ DeviceDetails { Connections { function onActiveChanged() { - updateDeviceDetails(); + root.updateDeviceDetails(); } function onWirelessDeviceDetailsChanged() { - if (network && network.ssid) { - const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); + if (root.network && root.network.ssid) { + const isActive = root.network.active || (Nmcli.active && Nmcli.active.ssid === root.network.ssid); if (isActive && Nmcli.wirelessDeviceDetails && Nmcli.wirelessDeviceDetails !== null) { connectionUpdateTimer.stop(); } @@ -189,10 +189,10 @@ DeviceDetails { interval: 500 repeat: true - running: network && network.ssid + running: root.network && root.network.ssid onTriggered: { - if (network) { - const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); + if (root.network) { + const isActive = root.network.active || (Nmcli.active && Nmcli.active.ssid === root.network.ssid); if (isActive) { if (!Nmcli.wirelessDeviceDetails || Nmcli.wirelessDeviceDetails === null) { Nmcli.getWirelessDeviceDetails("", () => {}); diff --git a/modules/controlcenter/network/WirelessList.qml b/modules/controlcenter/network/WirelessList.qml index aa0863c1..15fa293f 100644 --- a/modules/controlcenter/network/WirelessList.qml +++ b/modules/controlcenter/network/WirelessList.qml @@ -104,18 +104,20 @@ DeviceList { delegate: Component { StyledRect { + id: networkDelegate + required property var modelData width: ListView.view ? ListView.view.width : undefined - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.activeItem === modelData ? Colours.tPalette.m3surfaceContainer.a : 0) + color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.activeItem === networkDelegate.modelData ? Colours.tPalette.m3surfaceContainer.a : 0) radius: Appearance.rounding.normal StateLayer { function onClicked(): void { - root.session.network.active = modelData; - if (modelData && modelData.ssid) { - root.checkSavedProfileForNetwork(modelData.ssid); + root.session.network.active = networkDelegate.modelData; + if (networkDelegate.modelData && networkDelegate.modelData.ssid) { + root.checkSavedProfileForNetwork(networkDelegate.modelData.ssid); } } } @@ -135,16 +137,16 @@ DeviceList { implicitHeight: icon.implicitHeight + Appearance.padding.normal * 2 radius: Appearance.rounding.normal - color: modelData.active ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh + color: networkDelegate.modelData.active ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh MaterialIcon { id: icon anchors.centerIn: parent - text: Icons.getNetworkIcon(modelData.strength, modelData.isSecure) + text: Icons.getNetworkIcon(networkDelegate.modelData.strength, networkDelegate.modelData.isSecure) font.pointSize: Appearance.font.size.large - fill: modelData.active ? 1 : 0 - color: modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface + fill: networkDelegate.modelData.active ? 1 : 0 + color: networkDelegate.modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface } } @@ -158,7 +160,7 @@ DeviceList { elide: Text.ElideRight maximumLineCount: 1 - text: modelData.ssid || qsTr("Unknown") + text: networkDelegate.modelData.ssid || qsTr("Unknown") } RowLayout { @@ -168,18 +170,18 @@ DeviceList { StyledText { Layout.fillWidth: true text: { - if (modelData.active) + if (networkDelegate.modelData.active) return qsTr("Connected"); - if (modelData.isSecure && modelData.security && modelData.security.length > 0) { - return modelData.security; + if (networkDelegate.modelData.isSecure && networkDelegate.modelData.security && networkDelegate.modelData.security.length > 0) { + return networkDelegate.modelData.security; } - if (modelData.isSecure) + if (networkDelegate.modelData.isSecure) return qsTr("Secured"); return qsTr("Open"); } - color: modelData.active ? Colours.palette.m3primary : Colours.palette.m3outline + color: networkDelegate.modelData.active ? Colours.palette.m3primary : Colours.palette.m3outline font.pointSize: Appearance.font.size.small - font.weight: modelData.active ? 500 : 400 + font.weight: networkDelegate.modelData.active ? 500 : 400 elide: Text.ElideRight } } @@ -190,14 +192,14 @@ DeviceList { implicitHeight: connectIcon.implicitHeight + Appearance.padding.smaller * 2 radius: Appearance.rounding.full - color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.active ? 1 : 0) + color: Qt.alpha(Colours.palette.m3primaryContainer, networkDelegate.modelData.active ? 1 : 0) StateLayer { function onClicked(): void { - if (modelData.active) { + if (networkDelegate.modelData.active) { Nmcli.disconnectFromNetwork(); } else { - NetworkConnection.handleConnect(modelData, root.session, null); + NetworkConnection.handleConnect(networkDelegate.modelData, root.session, null); } } } @@ -206,8 +208,8 @@ DeviceList { id: connectIcon anchors.centerIn: parent - text: modelData.active ? "link_off" : "link" - color: modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface + text: networkDelegate.modelData.active ? "link_off" : "link" + color: networkDelegate.modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface } } } diff --git a/modules/controlcenter/network/WirelessPasswordDialog.qml b/modules/controlcenter/network/WirelessPasswordDialog.qml index a7fae489..9049ca0d 100644 --- a/modules/controlcenter/network/WirelessPasswordDialog.qml +++ b/modules/controlcenter/network/WirelessPasswordDialog.qml @@ -71,9 +71,7 @@ Item { enabled: session.network.showPasswordDialog && !isClosing focus: enabled - Keys.onEscapePressed: { - closeDialog(); - } + Keys.onEscapePressed: closeDialog() Rectangle { anchors.fill: parent @@ -86,7 +84,7 @@ Item { MouseArea { anchors.fill: parent - onClicked: closeDialog() + onClicked: root.closeDialog() } } @@ -132,7 +130,7 @@ Item { } } - Keys.onEscapePressed: closeDialog() + Keys.onEscapePressed: root.closeDialog() ColumnLayout { id: content @@ -465,7 +463,7 @@ Item { triggeredOnStart: false onTriggered: { repeatCount++; - checkConnectionStatus(); + root.checkConnectionStatus(); } onRunningChanged: { @@ -486,7 +484,7 @@ Item { connectionMonitor.stop(); connectButton.connecting = false; connectButton.text = qsTr("Connect"); - closeDialog(); + root.closeDialog(); } } } @@ -495,7 +493,7 @@ Item { Connections { function onActiveChanged() { if (root.visible) { - checkConnectionStatus(); + root.checkConnectionStatus(); } } function onConnectionFailed(ssid: string) { diff --git a/modules/launcher/items/AppItem.qml b/modules/launcher/items/AppItem.qml index 62ca0dd5..eb738a84 100644 --- a/modules/launcher/items/AppItem.qml +++ b/modules/launcher/items/AppItem.qml @@ -78,7 +78,7 @@ Item { asynchronous: true anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - active: modelData && Strings.testRegexList(Config.launcher.favouriteApps, modelData.id) + active: root.modelData && Strings.testRegexList(Config.launcher.favouriteApps, root.modelData.id) sourceComponent: MaterialIcon { text: "favorite" diff --git a/modules/utilities/cards/Toggles.qml b/modules/utilities/cards/Toggles.qml index ac4eae98..2ca93db6 100644 --- a/modules/utilities/cards/Toggles.qml +++ b/modules/utilities/cards/Toggles.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import qs.components import qs.components.controls import qs.services diff --git a/modules/windowinfo/Buttons.qml b/modules/windowinfo/Buttons.qml index fe4c621a..101405f7 100644 --- a/modules/windowinfo/Buttons.qml +++ b/modules/windowinfo/Buttons.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import qs.components import qs.services import qs.config diff --git a/services/NotifData.qml b/services/NotifData.qml index 031c87e8..d1648fa7 100644 --- a/services/NotifData.qml +++ b/services/NotifData.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import qs.config import qs.utils import Caelestia diff --git a/services/Players.qml b/services/Players.qml index c55cc09a..65954c69 100644 --- a/services/Players.qml +++ b/services/Players.qml @@ -25,12 +25,12 @@ Singleton { if (!Config.utilities.toasts.nowPlaying) { return; } - if (active.trackArtist != "" && active.trackTitle != "") { - Toaster.toast(qsTr("Now Playing"), qsTr("%1 - %2").arg(active.trackArtist).arg(active.trackTitle), "music_note"); + if (root.active.trackArtist != "" && root.active.trackTitle != "") { + Toaster.toast(qsTr("Now Playing"), qsTr("%1 - %2").arg(root.active.trackArtist).arg(root.active.trackTitle), "music_note"); } } - target: active + target: root.active } PersistentProperties {