Fix to make sure margins cant have partial values

CURA-4941
This commit is contained in:
Mark 2018-02-13 07:31:02 +01:00
parent d0fdf85eb1
commit 7ea654df3d
3 changed files with 18 additions and 18 deletions

View file

@ -26,7 +26,7 @@ SettingItem
anchors.fill: parent anchors.fill: parent
border.width: UM.Theme.getSize("default_lining").width border.width: Math.floor(UM.Theme.getSize("default_lining").width)
border.color: border.color:
{ {
if(!enabled) if(!enabled)
@ -76,7 +76,7 @@ SettingItem
Rectangle Rectangle
{ {
anchors.fill: parent; anchors.fill: parent;
anchors.margins: UM.Theme.getSize("default_lining").width; anchors.margins: Math.floor(UM.Theme.getSize("default_lining").width);
color: UM.Theme.getColor("setting_control_highlight") color: UM.Theme.getColor("setting_control_highlight")
opacity: !control.hovered ? 0 : propertyProvider.properties.validationState == "ValidatorState.Valid" ? 1.0 : 0.35; opacity: !control.hovered ? 0 : propertyProvider.properties.validationState == "ValidatorState.Valid" ? 1.0 : 0.35;
} }
@ -84,7 +84,7 @@ SettingItem
Label Label
{ {
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width anchors.rightMargin: Math.floor(UM.Theme.getSize("setting_unit_margin").width)
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
text: definition.unit; text: definition.unit;
@ -107,9 +107,9 @@ SettingItem
anchors anchors
{ {
left: parent.left left: parent.left
leftMargin: UM.Theme.getSize("setting_unit_margin").width leftMargin: Math.floor(UM.Theme.getSize("setting_unit_margin").width)
right: parent.right right: parent.right
rightMargin: UM.Theme.getSize("setting_unit_margin").width rightMargin: Math.floor(UM.Theme.getSize("setting_unit_margin").width)
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
renderType: Text.NativeRendering renderType: Text.NativeRendering

View file

@ -30,9 +30,9 @@ Item
{ {
top: parent.top top: parent.top
left: parent.left left: parent.left
leftMargin: UM.Theme.getSize("sidebar_margin").width leftMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
right: parent.right right: parent.right
rightMargin: UM.Theme.getSize("sidebar_margin").width rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
} }
Label Label
@ -87,7 +87,7 @@ Item
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("sidebar_margin").width anchors.rightMargin: Math.floor(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("sidebar_margin").width)
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button"); color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
iconSource: UM.Theme.getIcon("star"); iconSource: UM.Theme.getIcon("star");
@ -112,7 +112,7 @@ Item
id: filterContainer id: filterContainer
visible: true visible: true
border.width: UM.Theme.getSize("default_lining").width border.width: Math.floor(UM.Theme.getSize("default_lining").width)
border.color: border.color:
{ {
if(hoverMouseArea.containsMouse || clearFilterButton.containsMouse) if(hoverMouseArea.containsMouse || clearFilterButton.containsMouse)
@ -132,9 +132,9 @@ Item
top: globalProfileRow.bottom top: globalProfileRow.bottom
topMargin: UM.Theme.getSize("sidebar_margin").height topMargin: UM.Theme.getSize("sidebar_margin").height
left: parent.left left: parent.left
leftMargin: UM.Theme.getSize("sidebar_margin").width leftMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
right: parent.right right: parent.right
rightMargin: UM.Theme.getSize("sidebar_margin").width rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
} }
height: visible ? UM.Theme.getSize("setting_control").height : 0 height: visible ? UM.Theme.getSize("setting_control").height : 0
Behavior on height { NumberAnimation { duration: 100 } } Behavior on height { NumberAnimation { duration: 100 } }
@ -145,7 +145,7 @@ Item
anchors.left: parent.left anchors.left: parent.left
anchors.right: clearFilterButton.left anchors.right: clearFilterButton.left
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width anchors.rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
placeholderText: catalog.i18nc("@label:textbox", "Search...") placeholderText: catalog.i18nc("@label:textbox", "Search...")
@ -209,7 +209,7 @@ Item
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width anchors.rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
color: UM.Theme.getColor("setting_control_button") color: UM.Theme.getColor("setting_control_button")
hoverColor: UM.Theme.getColor("setting_control_button_hover") hoverColor: UM.Theme.getColor("setting_control_button_hover")
@ -238,7 +238,7 @@ Item
ListView ListView
{ {
id: contents id: contents
spacing: UM.Theme.getSize("default_lining").height; spacing: Math.floor(UM.Theme.getSize("default_lining").height);
cacheBuffer: 1000000; // Set a large cache to effectively just cache every list item. cacheBuffer: 1000000; // Set a large cache to effectively just cache every list item.
model: UM.SettingDefinitionsModel model: UM.SettingDefinitionsModel
@ -266,7 +266,7 @@ Item
{ {
id: delegate id: delegate
width: UM.Theme.getSize("sidebar").width; width: Math.floor(UM.Theme.getSize("sidebar").width);
height: provider.properties.enabled == "True" ? UM.Theme.getSize("section").height : - contents.spacing height: provider.properties.enabled == "True" ? UM.Theme.getSize("section").height : - contents.spacing
Behavior on height { NumberAnimation { duration: 100 } } Behavior on height { NumberAnimation { duration: 100 } }
opacity: provider.properties.enabled == "True" ? 1 : 0 opacity: provider.properties.enabled == "True" ? 1 : 0

View file

@ -121,7 +121,7 @@ QtObject {
Item Item
{ {
anchors.centerIn: parent anchors.centerIn: parent
width: textLabel.width + icon.width + Math.floor(Theme.getSize("default_margin").width / 2) width: Math.floor(textLabel.width + icon.width + Theme.getSize("default_margin").width / 2)
Label Label
{ {
id: textLabel id: textLabel
@ -329,9 +329,9 @@ QtObject {
UM.RecolorImage { UM.RecolorImage {
id: tool_button_arrow id: tool_button_arrow
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: (Theme.getSize("button").width - Math.floor(Theme.getSize("button_icon").width) / 4) anchors.rightMargin: Theme.getSize("button").width - Math.floor(Theme.getSize("button_icon").width / 4)
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
anchors.bottomMargin: (Theme.getSize("button").height - Math.floor(Theme.getSize("button_icon").height) / 4) anchors.bottomMargin: Theme.getSize("button").height - Math.floor(Theme.getSize("button_icon").height / 4)
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 sourceSize.width: width