diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 951de77f19..a02c0e0d5f 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -21,8 +21,14 @@ Window width: minimumWidth height: minimumHeight - // Set and unset the content. No need to keep things in memory if it's not visible. - onVisibleChanged: content.source = visible ? "Plugins.qml" : "" + onVisibleChanged: + { + pageSelectionTabBar.currentIndex = 0; //Go back to the initial tab. + while(contextStack.depth > 1) + { + contextStack.pop(); //Do NOT use the StackView.Immediate transition here, since it causes the window to stay empty. Seemingly a Qt bug: https://bugreports.qt.io/browse/QTBUG-60670? + } + } Connections { @@ -116,33 +122,33 @@ Window spacing: 0 background: Rectangle { color: "transparent" } + onCurrentIndexChanged: + { + searchBar.text = ""; + searchBar.visible = currentItem.hasSearch; + content.source = currentItem.sourcePage; + } + PackageTypeTab { id: pluginTabText width: implicitWidth text: catalog.i18nc("@button", "Plugins") - onClicked: - { - searchBar.text = "" - searchBar.visible = true - content.source = "Plugins.qml" - } + property string sourcePage: "Plugins.qml" + property bool hasSearch: true } PackageTypeTab { id: materialsTabText width: implicitWidth text: catalog.i18nc("@button", "Materials") - onClicked: - { - searchBar.text = "" - searchBar.visible = true - content.source = "Materials.qml" - } + property string sourcePage: "Materials.qml" + property bool hasSearch: true } ManagePackagesButton { - onClicked: content.source = "ManagedPackages.qml" + property string sourcePage: "ManagedPackages.qml" + property bool hasSearch: false } }