summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/IMouseArea.qml45
-rw-r--r--popups/launcher/Launcher.qml2
-rw-r--r--popups/launcher/components/App.qml7
-rw-r--r--popups/launcher/components/DuckDuckGo.qml6
-rw-r--r--popups/launcher/components/SelectionState.qml3
-rw-r--r--shell.qml2
6 files changed, 58 insertions, 7 deletions
diff --git a/components/IMouseArea.qml b/components/IMouseArea.qml
new file mode 100644
index 0000000..4c360ed
--- /dev/null
+++ b/components/IMouseArea.qml
@@ -0,0 +1,45 @@
+/// NOTE: This is not zero cost, there's performance penalty, only use this instead of mousearea if hover is strictly required to be still
+/// Such as when the component may appear where the mouse is already is
+
+import QtQuick
+
+MouseArea {
+ hoverEnabled: true
+
+ property real gx: Number.MAX_VALUE
+ property real gy: Number.MAX_VALUE
+
+ property bool hovered: false
+
+ signal entered_
+ signal positionChanged_(var mouse)
+
+ onPositionChanged: mouse => {
+ let gpos = mapToItem(null, mouse.x, mouse.y);
+
+ if (gx === Number.MAX_VALUE && gy === Number.MAX_VALUE) {
+ gx = gpos.x;
+ gy = gpos.y;
+ return;
+ }
+
+ if (gpos.x === gx && gpos.y === gy)
+ return;
+
+ gx = gpos.x;
+ gy = gpos.y;
+
+ if (!hovered) {
+ hovered = true;
+ entered_();
+ }
+
+ positionChanged_(mouse);
+ }
+
+ onExited: {
+ hovered = false;
+ gx = Number.MAX_VALUE;
+ gy = Number.MAX_VALUE;
+ }
+}
diff --git a/popups/launcher/Launcher.qml b/popups/launcher/Launcher.qml
index c138618..fd6b851 100644
--- a/popups/launcher/Launcher.qml
+++ b/popups/launcher/Launcher.qml
@@ -299,9 +299,11 @@ ILauncher {
// FIXME: prev predictiveCompletion still exists here
// workaround atm: just clear it or preserve the text manually
}
+
Connections {
target: item
ignoreUnknownSignals: true
+
function onClose() {
parentLoader.active = false;
}
diff --git a/popups/launcher/components/App.qml b/popups/launcher/components/App.qml
index a744f21..a44b2ec 100644
--- a/popups/launcher/components/App.qml
+++ b/popups/launcher/components/App.qml
@@ -89,6 +89,9 @@ IComponent {
onEntriesChanged: {
if (selectedIndex !== -1) {
+ if (selectedIndex > entries.length - 1)
+ selectedIndex = entries.length - 1;
+
syncSelectionState();
return;
}
@@ -175,10 +178,10 @@ IComponent {
}
}
- MouseArea {
+ IMouseArea {
anchors.fill: parent
hoverEnabled: true
- onEntered: {
+ onEntered_: {
root.selectedIndex = index;
}
onPressed: {
diff --git a/popups/launcher/components/DuckDuckGo.qml b/popups/launcher/components/DuckDuckGo.qml
index 9c36c79..379f56b 100644
--- a/popups/launcher/components/DuckDuckGo.qml
+++ b/popups/launcher/components/DuckDuckGo.qml
@@ -127,14 +127,16 @@ IComponent {
ScrollView {
id: scroll
Layout.fillWidth: true
- contentWidth: availableWidth
Layout.fillHeight: true
+ contentWidth: availableWidth
clip: true
ITextEdit {
id: text
- height: scroll.contentHeight
+
animate: true
+
+ height: scroll.contentHeight
width: scroll.contentWidth
readOnly: true
diff --git a/popups/launcher/components/SelectionState.qml b/popups/launcher/components/SelectionState.qml
index d8055d6..c133af8 100644
--- a/popups/launcher/components/SelectionState.qml
+++ b/popups/launcher/components/SelectionState.qml
@@ -40,9 +40,8 @@ Singleton {
if (!priorities[selectedPriority] && selectedPriority > 0) {
selectedPriority--;
Qt.callLater(step);
- } else {
+ } else
priorities[selectedPriority]?.syncSelectionState();
- }
});
}
}
diff --git a/shell.qml b/shell.qml
index 23dd631..6a2aaac 100644
--- a/shell.qml
+++ b/shell.qml
@@ -73,7 +73,7 @@ Scope {
readonly property list<Component> widgets: [
Component {
Loader {
- sourceComponent: Qt.createComponent("popups/launcher/components/" + "${component}.qml")
+ sourceComponent: Qt.createComponent("popups/launcher/components/${component}.qml")
onLoaded: {
item.standalone = true
item.state = selectionState;