Small qml speed improvements for setting item

This commit is contained in:
Jaime van Kessel 2019-10-25 15:09:31 +02:00
parent 624b8d8741
commit f090b5898e
No known key found for this signature in database
GPG key ID: 3710727397403C91
2 changed files with 18 additions and 16 deletions

View file

@ -89,7 +89,7 @@ class SettingInheritanceManager(QObject):
@pyqtSlot()
def forceUpdate(self) -> None:
self._update()
self._update_timer.start()
def _onActiveExtruderChanged(self) -> None:
new_active_stack = ExtruderManager.getInstance().getActiveExtruderStack()

View file

@ -23,17 +23,16 @@ Item
property alias contents: controlContainer.children
property alias hovered: mouse.containsMouse
property var showRevertButton: true
property var showInheritButton: true
property var showLinkedSettingIcon: true
property var doDepthIndentation: true
property var doQualityUserSettingEmphasis: true
property bool showRevertButton: true
property bool showInheritButton: true
property bool showLinkedSettingIcon: true
property bool doDepthIndentation: true
property bool doQualityUserSettingEmphasis: true
property var settingKey: definition.key //Used to detect each individual setting more easily in Squish GUI tests.
// Create properties to put property provider stuff in (bindings break in qt 5.5.1 otherwise)
property var state: propertyProvider.properties.state
// There is no resolve property if there is only one stack.
property var resolve: Cura.MachineManager.activeStackId !== Cura.MachineManager.activeMachine.id ? propertyProvider.properties.resolve : "None"
property var resolve: propertyProvider.properties.resolve
property var stackLevels: propertyProvider.stackLevels
property var stackLevel: stackLevels[0]
// A list of stack levels that will trigger to show the revert button
@ -149,7 +148,7 @@ Item
color: UM.Theme.getColor("setting_control_text")
opacity: (definition.visible) ? 1 : 0.5
// emphasize the setting if it has a value in the user or quality profile
font: base.doQualityUserSettingEmphasis && base.stackLevel != undefined && base.stackLevel <= 1 ? UM.Theme.getFont("default_italic") : UM.Theme.getFont("default")
font: base.doQualityUserSettingEmphasis && base.stackLevel !== undefined && base.stackLevel <= 1 ? UM.Theme.getFont("default_italic") : UM.Theme.getFont("default")
}
Row
@ -170,10 +169,11 @@ Item
{
id: linkedSettingIcon;
visible: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon
visible: Cura.MachineManager.activeStack !== Cura.MachineManager.activeMachine && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon
height: parent.height;
width: height;
anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
color: UM.Theme.getColor("setting_control_button")
hoverColor: UM.Theme.getColor("setting_control_button")
@ -184,7 +184,7 @@ Item
{
hoverTimer.stop()
var tooltipText = catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders.")
if ((resolve != "None") && (stackLevel != 0))
if ((resolve !== "None") && (stackLevel !== 0))
{
// We come here if a setting has a resolve and the setting is not manually edited.
tooltipText += " " + catalog.i18nc("@label", "The value is resolved from per-extruder values ") + "[" + Cura.ExtruderManager.getInstanceExtruderValues(definition.key) + "]."
@ -200,7 +200,8 @@ Item
visible: base.resetButtonVisible
height: parent.height
anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
color: UM.Theme.getColor("setting_control_button")
@ -278,7 +279,8 @@ Item
return Cura.SettingInheritanceManager.getOverridesForExtruder(definition.key, String(globalPropertyProvider.properties.limit_to_extruder)).indexOf(definition.key) >= 0
}
height: parent.height
anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
onClicked:
@ -296,7 +298,7 @@ Item
break
}
}
if ((last_entry == 4 || last_entry == 11) && base.stackLevel == 0 && base.stackLevels.length == 2)
if ((last_entry === 4 || last_entry === 11) && base.stackLevel === 0 && base.stackLevels.length === 2)
{
// Special case of the inherit reset. If only the definition (4th or 11th) container) and the first
// entry (user container) are set, we can simply remove the container.