From d7c6a87f395e5223f6b21b23438bd62e248f67b5 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Sat, 17 Sep 2022 02:58:54 +0300 Subject: [PATCH] effects/overview: Bind to search field using textEdited signal This special signal was designed to remove the need for such bikesheddings and workarounds. Use it to react to user-driven changes. BUG: 459202 FIXED-IN: 5.26 --- src/effects/overview/qml/ScreenView.qml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/effects/overview/qml/ScreenView.qml b/src/effects/overview/qml/ScreenView.qml index f98cd9b95f..84176594ad 100644 --- a/src/effects/overview/qml/ScreenView.qml +++ b/src/effects/overview/qml/ScreenView.qml @@ -32,7 +32,6 @@ FocusScope { function start() { animationEnabled = true; organized = true; - searchField.text = ""; } function stop() { @@ -205,16 +204,12 @@ FocusScope { focus: true Keys.priority: Keys.BeforeItem Keys.forwardTo: text && heap.count === 0 ? searchResults : heap - onTextChanged: { + text: effect.searchText + onTextEdited: { effect.searchText = text; heap.resetSelected(); heap.selectNextItem(WindowHeap.Direction.Down); } - Binding { - target: searchField - property: "text" - value: effect.searchText - } } } } @@ -227,13 +222,13 @@ FocusScope { id: placeholderMessage anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter - visible: container.organized && searchField.text && heap.count === 0 + visible: container.organized && effect.searchText.length > 0 && heap.count === 0 text: i18nd("kwin_effects", "No matching windows") } WindowHeap { id: heap - visible: !(container.organized && searchField.text) || heap.count !== 0 + visible: !(container.organized && effect.searchText.length > 0) || heap.count !== 0 anchors.fill: parent layout.mode: effect.layout focus: true @@ -248,7 +243,7 @@ FocusScope { desktop: KWinComponents.Workspace.currentVirtualDesktop screenName: targetScreen.name clientModel: stackModel - filter: searchField.text + filter: effect.searchText minimizedWindows: !effect.ignoreMinimized windowType: ~KWinComponents.ClientFilterModel.Dock & ~KWinComponents.ClientFilterModel.Desktop & @@ -287,8 +282,8 @@ FocusScope { anchors.horizontalCenter: parent.horizontalCenter width: parent.width / 2 height: parent.height - placeholderMessage.height - PlasmaCore.Units.largeSpacing - queryString: searchField.text - visible: container.organized && searchField.text && heap.count === 0 + queryString: effect.searchText + visible: container.organized && effect.searchText.length > 0 && heap.count === 0 onActivated: { effect.deactivate();