mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
Restore expanded categories when clearing filter
This commit is contained in:
parent
829f8893e2
commit
f7854225fa
1 changed files with 19 additions and 2 deletions
|
@ -32,9 +32,25 @@ Item
|
|||
|
||||
placeholderText: catalog.i18nc("@label:textbox", "Filter...")
|
||||
|
||||
property var expandedCategories
|
||||
property bool lastFilterEmpty: true
|
||||
|
||||
onTextChanged: {
|
||||
definitionsModel.filter = {"label": "*" + text};
|
||||
definitionsModel.expanded = text.length > 0 ? ["*"] : [""]
|
||||
var _filterEmpty = (text.length == 0);
|
||||
if(_filterEmpty != lastFilterEmpty)
|
||||
{
|
||||
if(!_filterEmpty)
|
||||
{
|
||||
expandedCategories = definitionsModel.expanded.slice();
|
||||
definitionsModel.expanded = ["*"];
|
||||
}
|
||||
else
|
||||
{
|
||||
definitionsModel.expanded = expandedCategories;
|
||||
}
|
||||
lastFilterEmpty = _filterEmpty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +71,8 @@ Item
|
|||
spacing: UM.Theme.getSize("default_lining").height;
|
||||
cacheBuffer: 1000000; // Set a large cache to effectively just cache every list item.
|
||||
|
||||
model: UM.SettingDefinitionsModel {
|
||||
model: UM.SettingDefinitionsModel
|
||||
{
|
||||
id: definitionsModel;
|
||||
containerId: Cura.MachineManager.activeDefinitionId
|
||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue