From 6a59a48a3584134b0c3779664e71acfa5f429830 Mon Sep 17 00:00:00 2001 From: Digital Artifex <7929434+DigitalArtifex@users.noreply.github.com> Date: Sun, 9 Aug 2026 03:37:26 -0400 Subject: [PATCH] Fixed clearing search term between pages --- KomplexHubContent/MainScreen.qml | 51 +++++++++++++++++-------- KomplexHubModule/Controls/SearchBar.qml | 5 +++ 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/KomplexHubContent/MainScreen.qml b/KomplexHubContent/MainScreen.qml index f610a03..a1e0acc 100644 --- a/KomplexHubContent/MainScreen.qml +++ b/KomplexHubContent/MainScreen.qml @@ -87,7 +87,8 @@ Rectangle { icon.width: 32 icon.url: "qrc:/images/icons/icons8-famous.svg" - onTriggered: () => { + onTriggered: () => + { pageLoader.page = "pages/HomePage.qml" if(currentMenuButton !== null) @@ -98,10 +99,12 @@ Rectangle { currentMenuButton = this searchContainer.preferredHeight = 0 + searchContainer.reset() } } - MenuButton { + MenuButton + { Layout.alignment: Qt.AlignTop height: 64 @@ -119,10 +122,12 @@ Rectangle { currentMenuButton = this searchContainer.preferredHeight = 50 + searchContainer.reset() } } - MenuButton { + MenuButton + { Layout.alignment: Qt.AlignTop height: 64 @@ -140,10 +145,12 @@ Rectangle { currentMenuButton = this searchContainer.preferredHeight = 50 + searchContainer.reset() } } - MenuButton { + MenuButton + { Layout.alignment: Qt.AlignTop height: 64 @@ -161,10 +168,12 @@ Rectangle { currentMenuButton = this searchContainer.preferredHeight = 50 + searchContainer.reset() } } - MenuButton { + MenuButton + { Layout.alignment: Qt.AlignTop height: 64 @@ -182,15 +191,18 @@ Rectangle { currentMenuButton = this searchContainer.preferredHeight = 0 + searchContainer.reset() } } - Item { + Item + { Layout.fillHeight: true Layout.minimumHeight: 100 } - MenuButton { + MenuButton + { Layout.alignment: Qt.AlignBottom height: 64 @@ -208,10 +220,12 @@ Rectangle { currentMenuButton = this searchContainer.preferredHeight = 0 + searchContainer.reset() } } - Behavior on opacity { + Behavior on opacity + { NumberAnimation { duration: 250 @@ -229,12 +243,14 @@ Rectangle { color: "transparent" - ColumnLayout { + ColumnLayout + { id: windowContainerLayout anchors.fill: parent spacing: 0 - SearchBar { + SearchBar + { property int preferredHeight: 50 id: searchContainer color: palette.base.lighter() @@ -245,7 +261,8 @@ Rectangle { icon: "qrc:/images/icons/icons8-search.svg" - onSearchTermChanged: () => { + onSearchTermChanged: () => + { pageLoader.setSearchTerm() } @@ -254,7 +271,8 @@ Rectangle { } } - Rectangle { + Rectangle + { id: windowContent Layout.fillHeight: true @@ -264,20 +282,23 @@ Rectangle { color: palette.base.darker() - Loader { + Loader + { property bool loading: false property string page anchors.fill: parent - onPageChanged: () => { + onPageChanged: () => + { loading = true fadeOutPage() } id: pageLoader - OpacityAnimator on opacity { + OpacityAnimator on opacity + { id: pageLoaderAnimation target: pageLoader diff --git a/KomplexHubModule/Controls/SearchBar.qml b/KomplexHubModule/Controls/SearchBar.qml index 5ba4ac2..b84db76 100644 --- a/KomplexHubModule/Controls/SearchBar.qml +++ b/KomplexHubModule/Controls/SearchBar.qml @@ -72,4 +72,9 @@ Item } } ] + + function reset() + { + searchEdit.text = "" + } }