Fixed clearing search term between pages

This commit is contained in:
Digital Artifex
2026-08-09 03:37:26 -04:00
parent 2f41ad19dd
commit 6a59a48a35
2 changed files with 41 additions and 15 deletions
+36 -15
View File
@@ -87,7 +87,8 @@ Rectangle {
icon.width: 32 icon.width: 32
icon.url: "qrc:/images/icons/icons8-famous.svg" icon.url: "qrc:/images/icons/icons8-famous.svg"
onTriggered: () => { onTriggered: () =>
{
pageLoader.page = "pages/HomePage.qml" pageLoader.page = "pages/HomePage.qml"
if(currentMenuButton !== null) if(currentMenuButton !== null)
@@ -98,10 +99,12 @@ Rectangle {
currentMenuButton = this currentMenuButton = this
searchContainer.preferredHeight = 0 searchContainer.preferredHeight = 0
searchContainer.reset()
} }
} }
MenuButton { MenuButton
{
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
height: 64 height: 64
@@ -119,10 +122,12 @@ Rectangle {
currentMenuButton = this currentMenuButton = this
searchContainer.preferredHeight = 50 searchContainer.preferredHeight = 50
searchContainer.reset()
} }
} }
MenuButton { MenuButton
{
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
height: 64 height: 64
@@ -140,10 +145,12 @@ Rectangle {
currentMenuButton = this currentMenuButton = this
searchContainer.preferredHeight = 50 searchContainer.preferredHeight = 50
searchContainer.reset()
} }
} }
MenuButton { MenuButton
{
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
height: 64 height: 64
@@ -161,10 +168,12 @@ Rectangle {
currentMenuButton = this currentMenuButton = this
searchContainer.preferredHeight = 50 searchContainer.preferredHeight = 50
searchContainer.reset()
} }
} }
MenuButton { MenuButton
{
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
height: 64 height: 64
@@ -182,15 +191,18 @@ Rectangle {
currentMenuButton = this currentMenuButton = this
searchContainer.preferredHeight = 0 searchContainer.preferredHeight = 0
searchContainer.reset()
} }
} }
Item { Item
{
Layout.fillHeight: true Layout.fillHeight: true
Layout.minimumHeight: 100 Layout.minimumHeight: 100
} }
MenuButton { MenuButton
{
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignBottom
height: 64 height: 64
@@ -208,10 +220,12 @@ Rectangle {
currentMenuButton = this currentMenuButton = this
searchContainer.preferredHeight = 0 searchContainer.preferredHeight = 0
searchContainer.reset()
} }
} }
Behavior on opacity { Behavior on opacity
{
NumberAnimation NumberAnimation
{ {
duration: 250 duration: 250
@@ -229,12 +243,14 @@ Rectangle {
color: "transparent" color: "transparent"
ColumnLayout { ColumnLayout
{
id: windowContainerLayout id: windowContainerLayout
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0
SearchBar { SearchBar
{
property int preferredHeight: 50 property int preferredHeight: 50
id: searchContainer id: searchContainer
color: palette.base.lighter() color: palette.base.lighter()
@@ -245,7 +261,8 @@ Rectangle {
icon: "qrc:/images/icons/icons8-search.svg" icon: "qrc:/images/icons/icons8-search.svg"
onSearchTermChanged: () => { onSearchTermChanged: () =>
{
pageLoader.setSearchTerm() pageLoader.setSearchTerm()
} }
@@ -254,7 +271,8 @@ Rectangle {
} }
} }
Rectangle { Rectangle
{
id: windowContent id: windowContent
Layout.fillHeight: true Layout.fillHeight: true
@@ -264,20 +282,23 @@ Rectangle {
color: palette.base.darker() color: palette.base.darker()
Loader { Loader
{
property bool loading: false property bool loading: false
property string page property string page
anchors.fill: parent anchors.fill: parent
onPageChanged: () => { onPageChanged: () =>
{
loading = true loading = true
fadeOutPage() fadeOutPage()
} }
id: pageLoader id: pageLoader
OpacityAnimator on opacity { OpacityAnimator on opacity
{
id: pageLoaderAnimation id: pageLoaderAnimation
target: pageLoader target: pageLoader
+5
View File
@@ -72,4 +72,9 @@ Item
} }
} }
] ]
function reset()
{
searchEdit.text = ""
}
} }