mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00

Before the first pulse, the _previousResolution property was still bound to the activeQualityType property of the MachineManager. When it then checks if it changed, it finds that it didn't change because it checks against that same property, but the _previousResolution automatically updated with it. After that it loses its binding because it's set in the function itself to a fixed value. Instead, we'll now give it its initial value with the Component.onCompleted function so that it doesn't bind, and then doesn't change along with the first change. Contributes to issue CURA-8849.
82 lines
No EOL
2.3 KiB
QML
82 lines
No EOL
2.3 KiB
QML
// Copyright (c) 2022 Ultimaker B.V.
|
|
// Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
import QtQuick 2.10
|
|
|
|
import UM 1.6 as UM
|
|
import Cura 1.7 as Cura
|
|
|
|
Item
|
|
{
|
|
id: recommendedResolutionSelector
|
|
height: childrenRect.height
|
|
|
|
property real labelColumnWidth: Math.round(width / 3)
|
|
property string _previousResolution: "" //Internal variable to detect changes.
|
|
Component.onCompleted: _previousResolution = Cura.MachineManager.activeQualityType;
|
|
|
|
Cura.IconWithText
|
|
{
|
|
id: resolutionTitle
|
|
anchors.top: parent.top
|
|
anchors.left: parent.left
|
|
source: UM.Theme.getIcon("PrintQuality")
|
|
text: catalog.i18nc("@label", "Resolution")
|
|
width: labelColumnWidth
|
|
height: parent.height
|
|
spacing: UM.Theme.getSize("thick_margin").width
|
|
iconSize: UM.Theme.getSize("medium_button_icon").width
|
|
}
|
|
|
|
Cura.ComboBox
|
|
{
|
|
id: visibilityPreset
|
|
implicitHeight: UM.Theme.getSize("combobox").height
|
|
implicitWidth: UM.Theme.getSize("combobox").width
|
|
anchors
|
|
{
|
|
top: parent.top
|
|
right: parent.right
|
|
}
|
|
|
|
textRole: "display_text"
|
|
textFormat: Text.StyledText
|
|
|
|
model: Cura.ActiveIntentQualitiesModel{}
|
|
|
|
currentIndex:
|
|
{
|
|
var current_quality_type = Cura.MachineManager.activeQualityType
|
|
|
|
var index = 0
|
|
for (var i = 0; i < model.count; i++)
|
|
{
|
|
if (model.getItem(i).quality_type == current_quality_type)
|
|
{
|
|
index = i
|
|
break
|
|
}
|
|
}
|
|
return index
|
|
}
|
|
|
|
onActivated:
|
|
{
|
|
var selected_item = model.getItem(currentIndex)
|
|
Cura.IntentManager.selectIntent(selected_item.intent_category, selected_item.quality_type)
|
|
}
|
|
|
|
Connections
|
|
{
|
|
target: Cura.IntentManager
|
|
function onIntentCategoryChanged()
|
|
{
|
|
if(recommendedResolutionSelector._previousResolution !== Cura.MachineManager.activeQualityType)
|
|
{
|
|
visibilityPreset.pulse();
|
|
}
|
|
recommendedResolutionSelector._previousResolution = Cura.MachineManager.activeQualityType;
|
|
}
|
|
}
|
|
}
|
|
} |