mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 08:25:56 +08:00
Fix resetting when Marketplace is closed and re-opened
Previously, this would cause the Marketplace to freeze. We're still not entirely sure why. It seems to be a bug in Qt, but it's rather hard to deal with. This new solution is nicer in some ways but not as neat in others. - We're no longer clearing the content of the loader, so the QML and the package data remains in memory while the Marketplace is closed. We deem this to not be a problem, because the memory usage of this package data is only a couple of kB, nothing compared to the memory used by the slicer when it loads a model. - On the other hand, it's now possible to programmatically change the tab there, instead of manually having to click the buttons. - Fixes a bug where the highlighted tab of of the tab bar doesn't update when closing and re-opening the Marketplace. And a bug where there was a search bar for the manage page while it didn't work. Contributes to issue CURA-8565.
This commit is contained in:
parent
6f65521ce8
commit
7fe327fb48
@ -21,8 +21,14 @@ Window
|
|||||||
width: minimumWidth
|
width: minimumWidth
|
||||||
height: minimumHeight
|
height: minimumHeight
|
||||||
|
|
||||||
// Set and unset the content. No need to keep things in memory if it's not visible.
|
onVisibleChanged:
|
||||||
onVisibleChanged: content.source = visible ? "Plugins.qml" : ""
|
{
|
||||||
|
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
|
Connections
|
||||||
{
|
{
|
||||||
@ -116,33 +122,33 @@ Window
|
|||||||
spacing: 0
|
spacing: 0
|
||||||
background: Rectangle { color: "transparent" }
|
background: Rectangle { color: "transparent" }
|
||||||
|
|
||||||
|
onCurrentIndexChanged:
|
||||||
|
{
|
||||||
|
searchBar.text = "";
|
||||||
|
searchBar.visible = currentItem.hasSearch;
|
||||||
|
content.source = currentItem.sourcePage;
|
||||||
|
}
|
||||||
|
|
||||||
PackageTypeTab
|
PackageTypeTab
|
||||||
{
|
{
|
||||||
id: pluginTabText
|
id: pluginTabText
|
||||||
width: implicitWidth
|
width: implicitWidth
|
||||||
text: catalog.i18nc("@button", "Plugins")
|
text: catalog.i18nc("@button", "Plugins")
|
||||||
onClicked:
|
property string sourcePage: "Plugins.qml"
|
||||||
{
|
property bool hasSearch: true
|
||||||
searchBar.text = ""
|
|
||||||
searchBar.visible = true
|
|
||||||
content.source = "Plugins.qml"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PackageTypeTab
|
PackageTypeTab
|
||||||
{
|
{
|
||||||
id: materialsTabText
|
id: materialsTabText
|
||||||
width: implicitWidth
|
width: implicitWidth
|
||||||
text: catalog.i18nc("@button", "Materials")
|
text: catalog.i18nc("@button", "Materials")
|
||||||
onClicked:
|
property string sourcePage: "Materials.qml"
|
||||||
{
|
property bool hasSearch: true
|
||||||
searchBar.text = ""
|
|
||||||
searchBar.visible = true
|
|
||||||
content.source = "Materials.qml"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ManagePackagesButton
|
ManagePackagesButton
|
||||||
{
|
{
|
||||||
onClicked: content.source = "ManagedPackages.qml"
|
property string sourcePage: "ManagedPackages.qml"
|
||||||
|
property bool hasSearch: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user