Set textFormat for the setting items to PlainText

Based on the Qt guide on making qml run much faster, it seems that the default of textFormatting (auto)
is quite expensive. As we make a *lot* of settingItems, which we don't want to format, it's better to set it to plain.
I haven't checked how much faster it actually is, but i didn't see visual changes, so it's at least a safe step.
This commit is contained in:
Jaime van Kessel 2018-09-20 15:22:35 +02:00
parent 6535f7890b
commit 2dbaa304a0
7 changed files with 12 additions and 3 deletions

View file

@ -79,6 +79,7 @@ Button
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
text: definition.label text: definition.label
textFormat: Text.PlainText
renderType: Text.NativeRendering renderType: Text.NativeRendering
font: UM.Theme.getFont("setting_category") font: UM.Theme.getFont("setting_category")
color: color:

View file

@ -73,6 +73,7 @@ SettingItem
anchors.right: downArrow.left anchors.right: downArrow.left
text: control.currentText text: control.currentText
textFormat: Text.PlainText
renderType: Text.NativeRendering renderType: Text.NativeRendering
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
@ -115,6 +116,7 @@ SettingItem
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
text: modelData.value text: modelData.value
textFormat: Text.PlainText
renderType: Text.NativeRendering renderType: Text.NativeRendering
color: control.contentItem.color color: control.contentItem.color
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")

View file

@ -145,6 +145,7 @@ SettingItem
rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width
text: control.currentText text: control.currentText
textFormat: Text.PlainText
renderType: Text.NativeRendering renderType: Text.NativeRendering
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")

View file

@ -115,6 +115,7 @@ Item {
text: definition.label text: definition.label
elide: Text.ElideMiddle; elide: Text.ElideMiddle;
renderType: Text.NativeRendering renderType: Text.NativeRendering
textFormat: Text.PlainText
color: UM.Theme.getColor("setting_control_text"); color: UM.Theme.getColor("setting_control_text");
opacity: (definition.visible) ? 1 : 0.5 opacity: (definition.visible) ? 1 : 0.5

View file

@ -140,6 +140,7 @@ SettingItem
rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width
text: control.currentText text: control.currentText
textFormat: Text.PlainText
renderType: Text.NativeRendering renderType: Text.NativeRendering
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
@ -199,6 +200,7 @@ SettingItem
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
text: model.name text: model.name
textFormat: Text.PlainText
renderType: Text.NativeRendering renderType: Text.NativeRendering
color: color:
{ {

View file

@ -94,6 +94,7 @@ SettingItem
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: definition.unit text: definition.unit
textFormat: Text.PlainText
renderType: Text.NativeRendering renderType: Text.NativeRendering
color: UM.Theme.getColor("setting_unit") color: UM.Theme.getColor("setting_unit")
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")

View file

@ -39,10 +39,11 @@ Item
Label Label
{ {
id: globalProfileLabel id: globalProfileLabel
text: catalog.i18nc("@label","Profile:"); text: catalog.i18nc("@label","Profile:")
textFormat: Text.PlainText
width: Math.round(parent.width * 0.45 - UM.Theme.getSize("sidebar_margin").width - 2) width: Math.round(parent.width * 0.45 - UM.Theme.getSize("sidebar_margin").width - 2)
font: UM.Theme.getFont("default"); font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text"); color: UM.Theme.getColor("text")
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom