Make switching Marketplace-tabs work with search-bar.

Reset search-bar (text) when switching tabs. Also hide search-bar (at least for now) when dealing with the managed packages tab.

part of CURA-8559
This commit is contained in:
Remco Burema 2021-11-12 15:37:59 +01:00
parent 44242dcd02
commit 24eaad4c6d
No known key found for this signature in database
GPG Key ID: 215C49431D43F98C

View File

@ -86,7 +86,8 @@ Window
Rectangle Rectangle
{ {
Layout.preferredHeight: parent.height Layout.preferredHeight: parent.height
Layout.preferredWidth: UM.Theme.getSize("thin_margin").width Layout.preferredWidth: searchBar.visible ? UM.Theme.getSize("thin_margin").width : 0
Layout.fillWidth: ! searchBar.visible
} }
Cura.SearchBar Cura.SearchBar
@ -94,7 +95,7 @@ Window
id: searchBar id: searchBar
Layout.preferredHeight: parent.height Layout.preferredHeight: parent.height
Layout.fillWidth: true Layout.fillWidth: true
onTextEdited: marketplaceDialog.searchStringChanged(text) onTextEdited: searchStringChanged(text)
} }
// Page selection. // Page selection.
@ -111,7 +112,12 @@ Window
width: implicitWidth width: implicitWidth
padding: UM.Theme.getSize("thin_margin").width padding: UM.Theme.getSize("thin_margin").width
text: catalog.i18nc("@button", "Plugins") text: catalog.i18nc("@button", "Plugins")
onClicked: content.source = "Plugins.qml" onClicked:
{
searchBar.text = ""
searchBar.visible = true
content.source = "Plugins.qml"
}
} }
PackageTypeTab PackageTypeTab
{ {
@ -119,7 +125,12 @@ Window
width: implicitWidth width: implicitWidth
padding: UM.Theme.getSize("thin_margin").width padding: UM.Theme.getSize("thin_margin").width
text: catalog.i18nc("@button", "Materials") text: catalog.i18nc("@button", "Materials")
onClicked: content.source = "Materials.qml" onClicked:
{
searchBar.text = ""
searchBar.visible = true
content.source = "Materials.qml"
}
} }
} }
TextMetrics TextMetrics
@ -143,6 +154,8 @@ Window
onClicked: onClicked:
{ {
searchBar.text = ""
searchBar.visible = false
content.source = "ManagedPackages.qml" content.source = "ManagedPackages.qml"
} }
} }