mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 21:27:50 -06:00
Switch to the new quality profile when it is created
This commit is contained in:
parent
a8bd57a9eb
commit
d2ffd59431
3 changed files with 44 additions and 15 deletions
|
@ -171,8 +171,36 @@ Item
|
|||
object: "<new name>"
|
||||
onAccepted:
|
||||
{
|
||||
base.newQualityChangesNameToSwitchTo = newName; // We want to switch to the new profile once it's created
|
||||
Cura.ContainerManager.createQualityChanges(newName);
|
||||
qualityListView.currentIndex = -1; // TODO: Reset selection.
|
||||
}
|
||||
}
|
||||
|
||||
property string newQualityChangesNameToSwitchTo: ""
|
||||
|
||||
// This connection makes sure that we will switch to the new
|
||||
Connections
|
||||
{
|
||||
target: qualitiesModel
|
||||
onItemsChanged: {
|
||||
var currentItemName = base.currentItem == null ? "" : base.currentItem.name;
|
||||
|
||||
for (var idx = 0; idx < qualitiesModel.rowCount(); ++idx) {
|
||||
var item = qualitiesModel.getItem(idx);
|
||||
if (base.newQualityChangesNameToSwitchTo != "") {
|
||||
if (item.name == base.newQualityChangesNameToSwitchTo) {
|
||||
// Switch to the newly created profile if needed
|
||||
qualityListView.currentIndex = idx;
|
||||
if (item.is_read_only) {
|
||||
Cura.MachineManager.setQualityGroup(item.quality_group);
|
||||
} else {
|
||||
Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group);
|
||||
}
|
||||
base.newQualityChangesNameToSwitchTo = "";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue