summaryrefslogtreecommitdiff
path: root/popups
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-09-01 23:46:10 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-09-01 23:46:10 +0800
commitbee452a0240fba8f1e17e6bcbadb5ed577c32d67 (patch)
treedc26b8f71294458e792ba59951ee3612badd5f7d /popups
parent78986a69ec394ab1f1d5d892a094b7084d52ea07 (diff)
fix: MouseArea not leaving properly
Diffstat (limited to 'popups')
-rw-r--r--popups/launcher/Launcher.qml1
-rw-r--r--popups/launcher/components/App.qml12
-rw-r--r--popups/launcher/components/Clip.qml24
-rw-r--r--popups/launcher/components/IComponent.qml4
4 files changed, 20 insertions, 21 deletions
diff --git a/popups/launcher/Launcher.qml b/popups/launcher/Launcher.qml
index fd6b851..adacc24 100644
--- a/popups/launcher/Launcher.qml
+++ b/popups/launcher/Launcher.qml
@@ -429,6 +429,7 @@ ILauncher {
}
if (set !== 0) {
+ launcher.state.priorities[launcher.state.selectedPriority].leave();
switch (set) {
case 1:
if (launcher.state.selectedPriority < launcher.state.priorities.length - 1) {
diff --git a/popups/launcher/components/App.qml b/popups/launcher/components/App.qml
index a44b2ec..89f3611 100644
--- a/popups/launcher/components/App.qml
+++ b/popups/launcher/components/App.qml
@@ -111,13 +111,6 @@ IComponent {
syncSelectionState: function () {
Qt.callLater(() => {
- if (!isSelectedPriority()) {
- if (state.selected === listView.itemAtIndex(selectedIndex))
- state.selected = null;
-
- return;
- }
-
if (selectedIndex < 0 || selectedIndex >= listView.count || !root.visible)
return;
@@ -126,6 +119,11 @@ IComponent {
});
}
+ onLeave: {
+ if (state.selected === listView.itemAtIndex(selectedIndex))
+ state.selected = null;
+ }
+
IInnerComponent {
id: layout
fromParent: false
diff --git a/popups/launcher/components/Clip.qml b/popups/launcher/components/Clip.qml
index 0a6429f..418ced7 100644
--- a/popups/launcher/components/Clip.qml
+++ b/popups/launcher/components/Clip.qml
@@ -73,14 +73,6 @@ IComponent {
syncSelectionState: function () {
Qt.callLater(() => {
- if (!isSelectedPriority()) {
- // TODO: fix sometimes
- if (state.selected && state.selected === listView.itemAtIndex(selectedIndex))
- state.selected = null;
-
- return;
- }
-
if (!root.visible || selectedIndex < 0 || selectedIndex >= listView.count)
return;
@@ -89,6 +81,12 @@ IComponent {
});
}
+ onLeave: {
+ // TODO: fix sometimes
+ if (state.selected && state.selected === listView.itemAtIndex(selectedIndex))
+ state.selected = null;
+ }
+
IInnerComponent {
id: layout
fromParent: false
@@ -122,7 +120,7 @@ IComponent {
clip: true
IconImage {
- scale: isSelectedPriority() && index === root.selectedIndex ? 1.01 : 0.9
+ scale: root.isSelectedPriority() && index === root.selectedIndex ? 1.01 : 0.9
source: modelData?.appIcon
implicitSize: parent.height
@@ -136,15 +134,15 @@ IComponent {
sourceComponent: modelData?.type === "image" ? img : text
readonly property Component text: IText {
text: String(modelData?.data || "").substring(0, General.maxClipPreviewChar).replace(/\n/g, " ")
- color: isSelectedPriority() && index === selectedIndex ? Colors.foreground1 : Colors.foreground2
+ color: root.isSelectedPriority() && index === selectedIndex ? Colors.foreground1 : Colors.foreground2
font.pixelSize: Launcher.widgetFontSize
- font.bold: isSelectedPriority() && index === selectedIndex
+ font.bold: root.isSelectedPriority() && index === selectedIndex
}
readonly property Component img: Image {
source: modelData?.data || ""
height: Launcher.widgetFontSize * 1.3
fillMode: Image.PreserveAspectFit
- scale: isSelectedPriority() && index === root.selectedIndex ? 1.01 : 0.9
+ scale: root.isSelectedPriority() && index === root.selectedIndex ? 1.01 : 0.9
MouseArea {
anchors.fill: parent
@@ -174,7 +172,7 @@ IComponent {
}
IText {
text: parent.sinceWhen || ""
- color: isSelectedPriority() && index === root.selectedIndex ? Colors.foreground2 : Colors.foreground3
+ color: root.isSelectedPriority() && index === root.selectedIndex ? Colors.foreground2 : Colors.foreground3
font.pixelSize: Launcher.widgetFontSize / 1.35
}
}
diff --git a/popups/launcher/components/IComponent.qml b/popups/launcher/components/IComponent.qml
index 90c3ab8..70d2576 100644
--- a/popups/launcher/components/IComponent.qml
+++ b/popups/launcher/components/IComponent.qml
@@ -66,6 +66,8 @@ IRect {
})
signal close
+ // SAFETY: implementer should include safety checks
+ signal leave
function _exec() {
if (!exec())
@@ -127,7 +129,7 @@ IRect {
if (hovered)
root.trySetSelfPriority();
else
- root.syncSelectionState();
+ root.leave();
}
}