diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-01-28 19:21:44 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-01-28 19:21:44 +1100 |
| commit | 9d7f0c48cebec02aaf2ca780b89a763ce91f8624 (patch) | |
| tree | 2345921b670f730268203020e754465503707ed3 /components/controls | |
| parent | controlcenter: remove qt5compat dep (diff) | |
| download | caelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.tar.gz caelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.tar.bz2 caelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.zip | |
internal: format
Diffstat (limited to 'components/controls')
| -rw-r--r-- | components/controls/CollapsibleSection.qml | 5 | ||||
| -rw-r--r-- | components/controls/SpinBoxRow.qml | 3 | ||||
| -rw-r--r-- | components/controls/SplitButtonRow.qml | 18 | ||||
| -rw-r--r-- | components/controls/StyledInputField.qml | 29 | ||||
| -rw-r--r-- | components/controls/SwitchRow.qml | 3 | ||||
| -rw-r--r-- | components/controls/ToggleButton.qml | 1 | ||||
| -rw-r--r-- | components/controls/ToggleRow.qml | 1 | ||||
| -rw-r--r-- | components/controls/Tooltip.qml | 43 |
8 files changed, 54 insertions, 49 deletions
diff --git a/components/controls/CollapsibleSection.qml b/components/controls/CollapsibleSection.qml index 8940884..e3d8eef 100644 --- a/components/controls/CollapsibleSection.qml +++ b/components/controls/CollapsibleSection.qml @@ -88,9 +88,7 @@ ColumnLayout { id: backgroundRect anchors.fill: parent radius: Appearance.rounding.normal - color: Colours.transparency.enabled - ? Colours.layer(Colours.palette.m3surfaceContainer, root.nested ? 3 : 2) - : (root.nested ? Colours.palette.m3surfaceContainerHigh : Colours.palette.m3surfaceContainer) + color: Colours.transparency.enabled ? Colours.layer(Colours.palette.m3surfaceContainer, root.nested ? 3 : 2) : (root.nested ? Colours.palette.m3surfaceContainerHigh : Colours.palette.m3surfaceContainer) opacity: root.showBackground && root.expanded ? 1.0 : 0.0 visible: root.showBackground @@ -132,4 +130,3 @@ ColumnLayout { } } } - diff --git a/components/controls/SpinBoxRow.qml b/components/controls/SpinBoxRow.qml index 4902627..fe6a198 100644 --- a/components/controls/SpinBoxRow.qml +++ b/components/controls/SpinBoxRow.qml @@ -14,7 +14,7 @@ StyledRect { required property real min required property real max property real step: 1 - property var onValueModified: function(value) {} + property var onValueModified: function (value) {} Layout.fillWidth: true implicitHeight: row.implicitHeight + Appearance.padding.large * 2 @@ -50,4 +50,3 @@ StyledRect { } } } - diff --git a/components/controls/SplitButtonRow.qml b/components/controls/SplitButtonRow.qml index 4ecc8bf..db9925f 100644 --- a/components/controls/SplitButtonRow.qml +++ b/components/controls/SplitButtonRow.qml @@ -14,20 +14,20 @@ StyledRect { required property string label property int expandedZ: 100 property bool enabled: true - + property alias menuItems: splitButton.menuItems property alias active: splitButton.active property alias expanded: splitButton.expanded property alias type: splitButton.type - + signal selected(item: MenuItem) Layout.fillWidth: true implicitHeight: row.implicitHeight + Appearance.padding.large * 2 radius: Appearance.rounding.normal color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - - clip: false + + clip: false z: splitButton.menu.implicitHeight > 0 ? expandedZ : 1 opacity: enabled ? 1.0 : 0.5 @@ -47,14 +47,14 @@ StyledRect { id: splitButton enabled: root.enabled type: SplitButton.Filled - + menu.z: 1 - + stateLayer.onClicked: { - splitButton.expanded = !splitButton.expanded + splitButton.expanded = !splitButton.expanded; } - - menu.onItemSelected: (item) => { + + menu.onItemSelected: item => { root.selected(item); } } diff --git a/components/controls/StyledInputField.qml b/components/controls/StyledInputField.qml index fcd0a33..0d199c7 100644 --- a/components/controls/StyledInputField.qml +++ b/components/controls/StyledInputField.qml @@ -15,12 +15,12 @@ Item { property int horizontalAlignment: TextInput.AlignHCenter property int implicitWidth: 70 property bool enabled: true - + // Expose activeFocus through alias to avoid FINAL property override readonly property alias hasFocus: inputField.activeFocus - + signal textEdited(string text) - signal editingFinished() + signal editingFinished implicitHeight: inputField.implicitHeight + Appearance.padding.small * 2 @@ -28,18 +28,18 @@ Item { id: container anchors.fill: parent - color: inputHover.containsMouse || inputField.activeFocus - ? Colours.layer(Colours.palette.m3surfaceContainer, 3) - : Colours.layer(Colours.palette.m3surfaceContainer, 2) + color: inputHover.containsMouse || inputField.activeFocus ? Colours.layer(Colours.palette.m3surfaceContainer, 3) : Colours.layer(Colours.palette.m3surfaceContainer, 2) radius: Appearance.rounding.small border.width: 1 - border.color: inputField.activeFocus - ? Colours.palette.m3primary - : Qt.alpha(Colours.palette.m3outline, 0.3) + border.color: inputField.activeFocus ? Colours.palette.m3primary : Qt.alpha(Colours.palette.m3outline, 0.3) opacity: root.enabled ? 1 : 0.5 - Behavior on color { CAnim {} } - Behavior on border.color { CAnim {} } + Behavior on color { + CAnim {} + } + Behavior on border.color { + CAnim {} + } MouseArea { id: inputHover @@ -58,23 +58,22 @@ Item { validator: root.validator readOnly: root.readOnly enabled: root.enabled - + Binding { target: inputField property: "text" value: root.text when: !inputField.activeFocus } - + onTextChanged: { root.text = text; root.textEdited(text); } - + onEditingFinished: { root.editingFinished(); } } } } - diff --git a/components/controls/SwitchRow.qml b/components/controls/SwitchRow.qml index 7fa3e1b..6dda3f0 100644 --- a/components/controls/SwitchRow.qml +++ b/components/controls/SwitchRow.qml @@ -12,7 +12,7 @@ StyledRect { required property string label required property bool checked property bool enabled: true - property var onToggled: function(checked) {} + property var onToggled: function (checked) {} Layout.fillWidth: true implicitHeight: row.implicitHeight + Appearance.padding.large * 2 @@ -46,4 +46,3 @@ StyledRect { } } } - diff --git a/components/controls/ToggleButton.qml b/components/controls/ToggleButton.qml index 8bdcb04..98c7564 100644 --- a/components/controls/ToggleButton.qml +++ b/components/controls/ToggleButton.qml @@ -122,4 +122,3 @@ StyledRect { Layout.minimumHeight: 0 } } - diff --git a/components/controls/ToggleRow.qml b/components/controls/ToggleRow.qml index 23dc2a2..269d3d6 100644 --- a/components/controls/ToggleRow.qml +++ b/components/controls/ToggleRow.qml @@ -26,4 +26,3 @@ RowLayout { cLayer: 2 } } - diff --git a/components/controls/Tooltip.qml b/components/controls/Tooltip.qml index d665083..b129a37 100644 --- a/components/controls/Tooltip.qml +++ b/components/controls/Tooltip.qml @@ -55,33 +55,47 @@ Popup { } Connections { target: root.target - function onXChanged() { if (root.tooltipVisible) root.updatePosition(); } - function onYChanged() { if (root.tooltipVisible) root.updatePosition(); } - function onWidthChanged() { if (root.tooltipVisible) root.updatePosition(); } - function onHeightChanged() { if (root.tooltipVisible) root.updatePosition(); } + function onXChanged() { + if (root.tooltipVisible) + root.updatePosition(); + } + function onYChanged() { + if (root.tooltipVisible) + root.updatePosition(); + } + function onWidthChanged() { + if (root.tooltipVisible) + root.updatePosition(); + } + function onHeightChanged() { + if (root.tooltipVisible) + root.updatePosition(); + } } function updatePosition() { - if (!target || !parent) return; - + if (!target || !parent) + return; + // Wait for tooltipRect to have its size calculated Qt.callLater(() => { - if (!target || !parent || !tooltipRect) return; - + if (!target || !parent || !tooltipRect) + return; + // Get target position in parent's coordinate system const targetPos = target.mapToItem(parent, 0, 0); const targetCenterX = targetPos.x + target.width / 2; - + // Get tooltip size (use width/height if available, otherwise implicit) const tooltipWidth = tooltipRect.width > 0 ? tooltipRect.width : tooltipRect.implicitWidth; const tooltipHeight = tooltipRect.height > 0 ? tooltipRect.height : tooltipRect.implicitHeight; - + // Center tooltip horizontally on target let newX = targetCenterX - tooltipWidth / 2; - + // Position tooltip above target let newY = targetPos.y - tooltipHeight - Appearance.spacing.small; - + // Keep within bounds const padding = Appearance.padding.normal; if (newX < padding) { @@ -89,7 +103,7 @@ Popup { } else if (newX + tooltipWidth > (parent.width - padding)) { newX = parent.width - tooltipWidth - padding; } - + // Update popup position x = newX; y = newY; @@ -156,7 +170,7 @@ Popup { id: tooltipText anchors.centerIn: parent - + text: root.text color: Colours.palette.m3onSurface font.pointSize: Appearance.font.size.small @@ -169,4 +183,3 @@ Popup { } } } - |