Use screenScaleFactor to consistently adapt sizes to display pixel ratio

This commit is contained in:
fieldOfView 2017-09-25 22:07:12 +02:00
parent 5e0052dcb6
commit c5fd0e6c80
21 changed files with 96 additions and 94 deletions

View file

@ -12,11 +12,13 @@ UM.Dialog
{ {
title: catalog.i18nc("@title:window", "Open Project") title: catalog.i18nc("@title:window", "Open Project")
width: 500 minimumWidth: 500 * screenScaleFactor
height: 400 minumumHeight: 400 * screenScaleFactor
width: minimumWidth
height: minumumHeight
property int comboboxHeight: 15 property int comboboxHeight: 15 * screenScaleFactor
property int spacerHeight: 10 property int spacerHeight: 10 * screenScaleFactor
onClosing: manager.notifyClosed() onClosing: manager.notifyClosed()
onVisibleChanged: onVisibleChanged:
@ -31,7 +33,7 @@ UM.Dialog
Item Item
{ {
anchors.fill: parent anchors.fill: parent
anchors.margins: 20 anchors.margins: 20 * screenScaleFactor
UM.I18nCatalog UM.I18nCatalog
{ {
@ -59,7 +61,7 @@ UM.Dialog
Column Column
{ {
anchors.fill: parent anchors.fill: parent
spacing: 2 spacing: 2 * screenScaleFactor
Label Label
{ {
id: titleLabel id: titleLabel
@ -373,7 +375,7 @@ UM.Dialog
enabled: true enabled: true
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: ok_button.left anchors.right: ok_button.left
anchors.rightMargin:2 anchors.rightMargin: 2 * screenScaleFactor
} }
Button Button
{ {

View file

@ -10,11 +10,11 @@ import UM 1.1 as UM
UM.Dialog UM.Dialog
{ {
width: 350 * Screen.devicePixelRatio; width: minimumWidth;
minimumWidth: 350 * Screen.devicePixelRatio; minimumWidth: 350 * screenScaleFactor;
height: 250 * Screen.devicePixelRatio; height: minimumHeight;
minimumHeight: 250 * Screen.devicePixelRatio; minimumHeight: 250 * screenScaleFactor;
title: catalog.i18nc("@title:window", "Convert Image...") title: catalog.i18nc("@title:window", "Convert Image...")
@ -23,8 +23,8 @@ UM.Dialog
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name:"cura"}
anchors.fill: parent; anchors.fill: parent;
Layout.fillWidth: true Layout.fillWidth: true
columnSpacing: 16 columnSpacing: 16 * screenScaleFactor
rowSpacing: 4 rowSpacing: 4 * screenScaleFactor
columns: 1 columns: 1
UM.TooltipArea { UM.TooltipArea {
@ -36,7 +36,7 @@ UM.Dialog
Label { Label {
text: catalog.i18nc("@action:label","Height (mm)") text: catalog.i18nc("@action:label","Height (mm)")
width: 150 width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@ -44,7 +44,7 @@ UM.Dialog
id: peak_height id: peak_height
objectName: "Peak_Height" objectName: "Peak_Height"
validator: DoubleValidator {notation: DoubleValidator.StandardNotation; bottom: -500; top: 500;} validator: DoubleValidator {notation: DoubleValidator.StandardNotation; bottom: -500; top: 500;}
width: 180 width: 180 * screenScaleFactor
onTextChanged: { manager.onPeakHeightChanged(text) } onTextChanged: { manager.onPeakHeightChanged(text) }
} }
} }
@ -59,7 +59,7 @@ UM.Dialog
Label { Label {
text: catalog.i18nc("@action:label","Base (mm)") text: catalog.i18nc("@action:label","Base (mm)")
width: 150 width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@ -67,7 +67,7 @@ UM.Dialog
id: base_height id: base_height
objectName: "Base_Height" objectName: "Base_Height"
validator: DoubleValidator {notation: DoubleValidator.StandardNotation; bottom: 0; top: 500;} validator: DoubleValidator {notation: DoubleValidator.StandardNotation; bottom: 0; top: 500;}
width: 180 width: 180 * screenScaleFactor
onTextChanged: { manager.onBaseHeightChanged(text) } onTextChanged: { manager.onBaseHeightChanged(text) }
} }
} }
@ -82,7 +82,7 @@ UM.Dialog
Label { Label {
text: catalog.i18nc("@action:label","Width (mm)") text: catalog.i18nc("@action:label","Width (mm)")
width: 150 width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@ -91,7 +91,7 @@ UM.Dialog
objectName: "Width" objectName: "Width"
focus: true focus: true
validator: DoubleValidator {notation: DoubleValidator.StandardNotation; bottom: 1; top: 500;} validator: DoubleValidator {notation: DoubleValidator.StandardNotation; bottom: 1; top: 500;}
width: 180 width: 180 * screenScaleFactor
onTextChanged: { manager.onWidthChanged(text) } onTextChanged: { manager.onWidthChanged(text) }
} }
} }
@ -106,7 +106,7 @@ UM.Dialog
Label { Label {
text: catalog.i18nc("@action:label","Depth (mm)") text: catalog.i18nc("@action:label","Depth (mm)")
width: 150 width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
TextField { TextField {
@ -114,7 +114,7 @@ UM.Dialog
objectName: "Depth" objectName: "Depth"
focus: true focus: true
validator: DoubleValidator {notation: DoubleValidator.StandardNotation; bottom: 1; top: 500;} validator: DoubleValidator {notation: DoubleValidator.StandardNotation; bottom: 1; top: 500;}
width: 180 width: 180 * screenScaleFactor
onTextChanged: { manager.onDepthChanged(text) } onTextChanged: { manager.onDepthChanged(text) }
} }
} }
@ -130,14 +130,14 @@ UM.Dialog
//Empty label so 2 column layout works. //Empty label so 2 column layout works.
Label { Label {
text: "" text: ""
width: 150 width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
ComboBox { ComboBox {
id: image_color_invert id: image_color_invert
objectName: "Image_Color_Invert" objectName: "Image_Color_Invert"
model: [ catalog.i18nc("@item:inlistbox","Lighter is higher"), catalog.i18nc("@item:inlistbox","Darker is higher") ] model: [ catalog.i18nc("@item:inlistbox","Lighter is higher"), catalog.i18nc("@item:inlistbox","Darker is higher") ]
width: 180 width: 180 * screenScaleFactor
onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) } onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) }
} }
} }
@ -152,13 +152,13 @@ UM.Dialog
Label { Label {
text: catalog.i18nc("@action:label","Smoothing") text: catalog.i18nc("@action:label","Smoothing")
width: 150 width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
Item { Item {
width: 180 width: 180 * screenScaleFactor
height: 20 height: 20 * screenScaleFactor
Layout.fillWidth: true Layout.fillWidth: true
Slider { Slider {

View file

@ -111,7 +111,7 @@ Item
visible: !UM.LayerView.compatibilityMode visible: !UM.LayerView.compatibilityMode
style: UM.Theme.styles.combobox style: UM.Theme.styles.combobox
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 10 anchors.rightMargin: 10 * screenScaleFactor
onActivated: onActivated:
{ {
@ -602,7 +602,7 @@ Item
anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2; anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
width: Math.max(UM.Theme.getSize("line").width * maxValue.length + 2, 20); width: Math.max(UM.Theme.getSize("line").width * maxValue.length + 2 * screenScaleFactor, 20);
style: TextFieldStyle style: TextFieldStyle
{ {
textColor: UM.Theme.getColor("setting_control_text"); textColor: UM.Theme.getColor("setting_control_text");

View file

@ -30,7 +30,7 @@ Item {
{ {
// This is to ensure that the panel is first increasing in size up to 200 and then shows a scrollbar. // This is to ensure that the panel is first increasing in size up to 200 and then shows a scrollbar.
// It kinda looks ugly otherwise (big panel, no content on it) // It kinda looks ugly otherwise (big panel, no content on it)
property int maximumHeight: 200 * Screen.devicePixelRatio property int maximumHeight: 200 * screenScaleFactor
height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight)
ScrollView ScrollView
@ -246,7 +246,7 @@ Item {
id: settingPickDialog id: settingPickDialog
title: catalog.i18nc("@title:window", "Select Settings to Customize for this model") title: catalog.i18nc("@title:window", "Select Settings to Customize for this model")
width: Screen.devicePixelRatio * 360; width: screenScaleFactor * 360;
property string labelFilter: "" property string labelFilter: ""

View file

@ -9,10 +9,10 @@ UM.Dialog
id: base id: base
title: catalog.i18nc("@title:window", "Find & Update plugins") title: catalog.i18nc("@title:window", "Find & Update plugins")
width: 600 * Screen.devicePixelRatio width: 600 * screenScaleFactor
height: 450 * Screen.devicePixelRatio height: 450 * screenScaleFactor
minimumWidth: 350 * Screen.devicePixelRatio minimumWidth: 350 * screenScaleFactor
minimumHeight: 350 * Screen.devicePixelRatio minimumHeight: 350 * screenScaleFactor
Item Item
{ {
anchors.fill: parent anchors.fill: parent

View file

@ -298,8 +298,8 @@ Cura.MachineAction
title: catalog.i18nc("@title:window", "Printer Address") title: catalog.i18nc("@title:window", "Printer Address")
minimumWidth: 400 * Screen.devicePixelRatio minimumWidth: 400 * screenScaleFactor
minimumHeight: 120 * Screen.devicePixelRatio minimumHeight: 120 * screenScaleFactor
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight

View file

@ -11,10 +11,10 @@ UM.Dialog
{ {
id: base; id: base;
width: 500 * Screen.devicePixelRatio; width: minimumWidth;
minimumWidth: 500 * Screen.devicePixelRatio; minimumWidth: 500 * screenScaleFactor;
height: 100 * Screen.devicePixelRatio; height: minimumHeight;
minimumHeight: 100 * Screen.devicePixelRatio; minimumHeight: 100 * screenScaleFactor;
visible: true; visible: true;
modality: Qt.ApplicationModal; modality: Qt.ApplicationModal;

View file

@ -18,8 +18,8 @@ UM.Dialog
id: base id: base
title: catalog.i18nc("@title:window", "Open project file") title: catalog.i18nc("@title:window", "Open project file")
width: 450 width: 450 * screenScaleFactor
height: 150 height: 150 * screenScaleFactor
maximumHeight: height maximumHeight: height
maximumWidth: width maximumWidth: width
@ -61,10 +61,10 @@ UM.Dialog
Column Column
{ {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 20 anchors.leftMargin: 20 * screenScaleFactor
anchors.rightMargin: 20 anchors.rightMargin: 20 * screenScaleFactor
anchors.bottomMargin: 20 anchors.bottomMargin: 20 * screenScaleFactor
spacing: 10 spacing: 10 * screenScaleFactor
Label Label
{ {

View file

@ -14,8 +14,8 @@ UM.Dialog
id: base id: base
title: catalog.i18nc("@title:window", "Discard or Keep changes") title: catalog.i18nc("@title:window", "Discard or Keep changes")
width: 800 width: 800 * screenScaleFactor
height: 400 height: 400 * screenScaleFactor
property var changesModel: Cura.UserChangesModel{ id: userChangesModel} property var changesModel: Cura.UserChangesModel{ id: userChangesModel}
onVisibilityChanged: onVisibilityChanged:
{ {

View file

@ -67,7 +67,7 @@ Button
height: UM.Theme.getSize("extruder_button_material").height height: UM.Theme.getSize("extruder_button_material").height
radius: width / 2 radius: width / 2
border.width: 1 border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("extruder_button_material_border") border.color: UM.Theme.getColor("extruder_button_material_border")
opacity: !base.enabled ? 0.2 : 1.0 opacity: !base.enabled ? 0.2 : 1.0

View file

@ -17,8 +17,8 @@ UM.Dialog
id: base id: base
title: catalog.i18nc("@title:window", "Open file(s)") title: catalog.i18nc("@title:window", "Open file(s)")
width: 420 width: 420 * screenScaleFactor
height: 170 height: 170 * screenScaleFactor
maximumHeight: height maximumHeight: height
maximumWidth: width maximumWidth: width
@ -28,7 +28,7 @@ UM.Dialog
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal; modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
property var fileUrls: [] property var fileUrls: []
property int spacerHeight: 10 property int spacerHeight: 10 * screenScaleFactor
function loadProjectFile(projectFile) function loadProjectFile(projectFile)
{ {
@ -52,12 +52,12 @@ UM.Dialog
Column Column
{ {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 20 anchors.leftMargin: 20 * screenScaleFactor
anchors.rightMargin: 20 anchors.rightMargin: 20 * screenScaleFactor
anchors.bottomMargin: 20 anchors.bottomMargin: 20 * screenScaleFactor
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: 10 spacing: 10 * screenScaleFactor
Label Label
{ {

View file

@ -513,7 +513,7 @@ UM.PreferencesPage
Column Column
{ {
spacing: 4 spacing: 4 * screenScaleFactor
Label Label
{ {
@ -523,7 +523,7 @@ UM.PreferencesPage
ComboBox ComboBox
{ {
id: choiceOnOpenProjectDropDownButton id: choiceOnOpenProjectDropDownButton
width: 200 width: 200 * screenScaleFactor
model: ListModel model: ListModel
{ {
@ -572,7 +572,7 @@ UM.PreferencesPage
Column Column
{ {
spacing: 4 spacing: 4 * screenScaleFactor
Label Label
{ {
@ -583,7 +583,7 @@ UM.PreferencesPage
ComboBox ComboBox
{ {
id: choiceOnProfileOverrideDropDownButton id: choiceOnProfileOverrideDropDownButton
width: 200 width: 200 * screenScaleFactor
model: ListModel model: ListModel
{ {

View file

@ -91,7 +91,7 @@ UM.ManagementPage
Item Item
{ {
width: childrenRect.width + 2 width: childrenRect.width + 2 * screenScaleFactor
height: childrenRect.height height: childrenRect.height
Button Button
{ {
@ -112,8 +112,6 @@ UM.ManagementPage
{ {
id: actionDialog id: actionDialog
property var content property var content
minimumWidth: 350
minimumHeight: 350
onContentChanged: onContentChanged:
{ {
contents = content; contents = content;
@ -257,8 +255,8 @@ UM.ManagementPage
UM.RenameDialog UM.RenameDialog
{ {
id: renameDialog; id: renameDialog;
width: 300 width: 300 * screenScaleFactor
height: 150 height: 150 * screenScaleFactor
object: base.currentItem && base.currentItem.name ? base.currentItem.name : ""; object: base.currentItem && base.currentItem.name ? base.currentItem.name : "";
property var machine_name_validator: Cura.MachineNameValidator { } property var machine_name_validator: Cura.MachineNameValidator { }
validName: renameDialog.newName.match(renameDialog.machine_name_validator.machineNameRegex) != null; validName: renameDialog.newName.match(renameDialog.machine_name_validator.machineNameRegex) != null;

View file

@ -86,8 +86,8 @@ SettingItem
source: UM.Theme.getIcon("arrow_bottom") source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text"); color: UM.Theme.getColor("setting_control_text");

View file

@ -137,8 +137,8 @@ SettingItem
source: UM.Theme.getIcon("arrow_bottom") source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text") color: UM.Theme.getColor("setting_control_text")
} }

View file

@ -156,8 +156,8 @@ SettingItem
source: UM.Theme.getIcon("arrow_bottom") source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text") color: UM.Theme.getColor("setting_control_text")
} }

View file

@ -408,8 +408,8 @@ Item
groove: Rectangle { groove: Rectangle {
id: groove id: groove
implicitWidth: 200 implicitWidth: 200 * screenScaleFactor
implicitHeight: 2 implicitHeight: 2 * screenScaleFactor
color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
radius: 1 radius: 1
} }
@ -419,8 +419,8 @@ Item
id: handleButton id: handleButton
anchors.centerIn: parent anchors.centerIn: parent
color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
implicitWidth: 10 implicitWidth: 10 * screenScaleFactor
implicitHeight: 10 implicitHeight: 10 * screenScaleFactor
radius: 10 radius: 10
} }
} }
@ -431,8 +431,8 @@ Item
Rectangle { Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
width: 1 width: 1 * screenScaleFactor
height: 6 height: 6 * screenScaleFactor
y: 0 y: 0
x: styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1)) x: styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))
} }
@ -484,7 +484,7 @@ Item
UM.RecolorImage { UM.RecolorImage {
anchors.fill: parent anchors.fill: parent
anchors.margins: 2 anchors.margins: 2 * screenScaleFactor
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
source: UM.Theme.getIcon(model.icon) source: UM.Theme.getIcon(model.icon)

View file

@ -67,7 +67,7 @@ Item
} }
} }
Item { height: UM.Theme.getSize("default_margin").height; width: 1; visible: extruders.count > 0 } Item { height: UM.Theme.getSize("default_margin").height; width: UM.Theme.getSize("default_lining"); visible: extruders.count > 0 }
Repeater Repeater
{ {

View file

@ -13,10 +13,12 @@ UM.Dialog
{ {
title: catalog.i18nc("@title:window", "Save Project") title: catalog.i18nc("@title:window", "Save Project")
width: 500 minimumWidth: 500 * screenScaleFactor
height: 400 minimumHeight: 400 * screenScaleFactor
width: minimumWidth
height: minimumHeight
property int spacerHeight: 10 property int spacerHeight: 10 * screenScaleFactor
property bool dontShowAgain: true property bool dontShowAgain: true
@ -63,7 +65,7 @@ UM.Dialog
Column Column
{ {
anchors.fill: parent anchors.fill: parent
spacing: 2 spacing: 2 * screenScaleFactor
Label Label
{ {
id: titleLabel id: titleLabel

View file

@ -309,7 +309,7 @@ QtObject {
} }
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 : 0 border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
border.color: Theme.getColor("tool_button_border") border.color: Theme.getColor("tool_button_border")
UM.RecolorImage { UM.RecolorImage {
@ -506,8 +506,8 @@ QtObject {
source: control.iconSource; source: control.iconSource;
width: Theme.getSize("section_icon").width; width: Theme.getSize("section_icon").width;
height: Theme.getSize("section_icon").height; height: Theme.getSize("section_icon").height;
sourceSize.width: width + 15 sourceSize.width: width + 15 * screenScaleFactor
sourceSize.height: width + 15 sourceSize.height: width + 15 * screenScaleFactor
} }
} }
@ -648,8 +648,8 @@ QtObject {
source: Theme.getIcon("arrow_bottom") source: Theme.getIcon("arrow_bottom")
width: Theme.getSize("standard_arrow").width width: Theme.getSize("standard_arrow").width
height: Theme.getSize("standard_arrow").height height: Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 sourceSize.height: width + 5 * screenScaleFactor
color: Theme.getColor("setting_control_text"); color: Theme.getColor("setting_control_text");
} }
@ -707,8 +707,8 @@ QtObject {
source: UM.Theme.getIcon("arrow_bottom") source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text") color: UM.Theme.getColor("setting_control_text")
} }