diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 536c6c30d6..a905008932 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -70,8 +70,8 @@ Cura.MachineAction anchors.top: pageTitle.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height - property real columnWidth: ((width - 3 * UM.Theme.getSize("default_margin").width) / 2) | 0 - property real labelColumnWidth: columnWidth * 0.5 + property real columnWidth: Math.floor((width - 3 * UM.Theme.getSize("default_margin").width) / 2) + property real labelColumnWidth: Math.floor(columnWidth / 2) Tab { diff --git a/plugins/SimulationView/SimulationView.qml b/plugins/SimulationView/SimulationView.qml index 1f403cecac..6d1a11d8c8 100644 --- a/plugins/SimulationView/SimulationView.qml +++ b/plugins/SimulationView/SimulationView.qml @@ -461,7 +461,7 @@ Item visible: viewSettings.show_feedrate_gradient anchors.left: parent.right height: parent.width - width: UM.Theme.getSize("layerview_row").height * 1.5 + width: Math.floor(UM.Theme.getSize("layerview_row").height * 1.5) border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} @@ -492,7 +492,7 @@ Item visible: viewSettings.show_thickness_gradient anchors.left: parent.right height: parent.width - width: UM.Theme.getSize("layerview_row").height * 1.5 + width: Math.floor(UM.Theme.getSize("layerview_row").height * 1.5) border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index d3b17873c3..39b59e58cb 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -483,7 +483,7 @@ UM.MainWindow anchors { horizontalCenter: parent.horizontalCenter - horizontalCenterOffset: -(Math.floor(UM.Theme.getSize("sidebar").width/ 2)) + horizontalCenterOffset: -(Math.floor(UM.Theme.getSize("sidebar").width / 2)) top: parent.verticalCenter; bottom: parent.bottom; } diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index c701e5ebf4..5c5254b129 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -94,7 +94,7 @@ Item { { id: printJobTextfield anchors.right: printJobPencilIcon.left - anchors.rightMargin: Math.floor(UM.Theme.getSize("default_margin").width/2) + anchors.rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2) height: UM.Theme.getSize("jobspecs_line").height width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50) maximumLength: 120 diff --git a/resources/qml/Preferences/MaterialView.qml b/resources/qml/Preferences/MaterialView.qml index b2307fe4f6..e5319e280a 100644 --- a/resources/qml/Preferences/MaterialView.qml +++ b/resources/qml/Preferences/MaterialView.qml @@ -98,7 +98,7 @@ TabView Row { width: scrollView.columnWidth height: parent.rowHeight - spacing: Math.floor(UM.Theme.getSize("default_margin").width/2) + spacing: Math.floor(UM.Theme.getSize("default_margin").width / 2) // color indicator square Rectangle { diff --git a/resources/qml/Preferences/MaterialsPage.qml b/resources/qml/Preferences/MaterialsPage.qml index 228f9c8ea2..b67430aaa4 100644 --- a/resources/qml/Preferences/MaterialsPage.qml +++ b/resources/qml/Preferences/MaterialsPage.qml @@ -59,8 +59,8 @@ UM.ManagementPage anchors.right: parent.right Rectangle { - width: (parent.height * 0.8) | 0 - height: (parent.height * 0.8) | 0 + width: Math.floor(parent.height * 0.8) + height: Math.floor(parent.height * 0.8) color: model.metadata.color_code border.color: isCurrentItem ? palette.highlightedText : palette.text; anchors.verticalCenter: parent.verticalCenter diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index f21b74be3a..f5dd714ffe 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -76,7 +76,7 @@ Item { width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width height: UM.Theme.getSize("progressbar").height anchors.top: statusLabel.bottom - anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height/4) + anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 4) anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width radius: UM.Theme.getSize("progressbar_radius").width diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index ab0d54158d..4249b4fffa 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -187,8 +187,8 @@ Button id: settingsButton visible: base.hovered || settingsButton.hovered - height: base.height * 0.6 - width: base.height * 0.6 + height: Math.floor(base.height * 0.6) + width: Math.floor(base.height * 0.6) anchors { right: inheritButton.visible ? inheritButton.left : parent.right diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index 6f1d5e9e48..9d4f9de48d 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -68,7 +68,7 @@ SettingItem { id: downArrow x: control.width - width - control.rightPadding - y: control.topPadding + (control.availableHeight - height) / 2 + y: control.topPadding + Math.floor((control.availableHeight - height) / 2) source: UM.Theme.getIcon("arrow_bottom") width: UM.Theme.getSize("standard_arrow").width diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 7d789d2573..ce27d354bc 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -108,7 +108,7 @@ Item { id: label; anchors.left: parent.left; - anchors.leftMargin: doDepthIndentation ? (UM.Theme.getSize("section_icon_column").width + 5) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width) : 0 + anchors.leftMargin: doDepthIndentation ? Math.floor((UM.Theme.getSize("section_icon_column").width + 5) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0 anchors.right: settingControls.left; anchors.verticalCenter: parent.verticalCenter diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 57e613a00f..648c2db3b9 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -204,7 +204,7 @@ Item iconSource: UM.Theme.getIcon("cross1") visible: findingSettings - height: parent.height * 0.4 + height: Math.floor(parent.height * 0.4) width: visible ? height : 0 anchors.verticalCenter: parent.verticalCenter @@ -388,7 +388,7 @@ Item contextMenu.provider = provider contextMenu.popup(); } - onShowTooltip: base.showTooltip(delegate, { x: -UM.Theme.getSize("default_arrow").width, y: delegate.height / 2 }, text) + onShowTooltip: base.showTooltip(delegate, { x: -UM.Theme.getSize("default_arrow").width, y: Math.floor(delegate.height / 2) }, text) onHideTooltip: base.hideTooltip() onShowAllHiddenInheritedSettings: { diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index a16894a33f..7d944a62d6 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -171,7 +171,7 @@ Rectangle id: control height: settingsModeSelection.height - width: Math.floor(0.5 * parent.width) + width: Math.floor(parent.width / 2) anchors.left: parent.left anchors.leftMargin: model.index * Math.floor(settingsModeSelection.width / 2) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index a64499fdba..83dfefdb9a 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -257,7 +257,7 @@ Column visible: Cura.MachineManager.hasMaterials enabled: !extrudersList.visible || base.currentExtruderIndex > -1 height: UM.Theme.getSize("setting_control").height - width: parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width + width: Math.floor(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width anchors.right: parent.right style: UM.Theme.styles.sidebar_header_button activeFocusOnPress: true; diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 98d049b2d1..8371d5b84e 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -146,16 +146,16 @@ Item } function calculateSliderStepWidth (totalTicks) { - qualityModel.qualitySliderStepWidth = totalTicks != 0 ? (base.width * 0.55) / (totalTicks) : 0 + qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.floor((base.width * 0.55) / (totalTicks)) : 0 } function calculateSliderMargins (availableMin, availableMax, totalTicks) { if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) { - qualityModel.qualitySliderMarginRight = base.width * 0.55 + qualityModel.qualitySliderMarginRight = Math.floor(base.width * 0.55) } else if (availableMin == availableMax) { - qualityModel.qualitySliderMarginRight = (totalTicks - availableMin) * qualitySliderStepWidth + qualityModel.qualitySliderMarginRight = Math.floor((totalTicks - availableMin) * qualitySliderStepWidth) } else { - qualityModel.qualitySliderMarginRight = (totalTicks - availableMax) * qualitySliderStepWidth + qualityModel.qualitySliderMarginRight = Math.floor((totalTicks - availableMax) * qualitySliderStepWidth) } } @@ -236,7 +236,7 @@ Item Item { id: speedSlider - width: base.width * 0.55 + width: Math.floor(base.width * 0.55) height: UM.Theme.getSize("sidebar_margin").height anchors.right: parent.right anchors.top: parent.top @@ -246,7 +246,7 @@ Item Rectangle { id: groovechildrect - width: base.width * 0.55 + width: Math.floor(base.width * 0.55) height: 2 * screenScaleFactor color: UM.Theme.getColor("quality_slider_unavailable") anchors.verticalCenter: qualitySlider.verticalCenter @@ -266,7 +266,7 @@ Item width: 1 * screenScaleFactor height: 6 * screenScaleFactor y: 0 - x: qualityModel.qualitySliderStepWidth * index + x: Math.floor(qualityModel.qualitySliderStepWidth * index) } } @@ -362,7 +362,7 @@ Item text: catalog.i18nc("@label", "Print Speed") font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") - width: parseInt(UM.Theme.getSize("sidebar").width * 0.35) + width: Math.floor(UM.Theme.getSize("sidebar").width * 0.35) elide: Text.ElideRight } @@ -438,7 +438,7 @@ Item anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2 anchors.left: parent.left - width: parseInt(UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width) + width: Math.floor(UM.Theme.getSize("sidebar").width * .45) - UM.Theme.getSize("sidebar_margin").width Label { @@ -448,7 +448,7 @@ Item color: UM.Theme.getColor("text") anchors.top: parent.top - anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height * 1.7) + anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 1.7) anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width } @@ -459,7 +459,7 @@ Item id: infillCellRight height: infillSlider.height + UM.Theme.getSize("sidebar_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("sidebar_margin").height) - width: parseInt(UM.Theme.getSize("sidebar").width * .55) + width: Math.floor(UM.Theme.getSize("sidebar").width * .55) anchors.left: infillCellLeft.right anchors.top: infillCellLeft.top @@ -737,7 +737,7 @@ Item visible: enableSupportCheckBox.visible anchors.top: infillCellRight.bottom - anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height * 1.5) + anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 1.5) anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.right: infillCellLeft.right @@ -823,7 +823,7 @@ Item anchors.topMargin: ((supportEnabled.properties.value === "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("sidebar_margin").height : 0 anchors.left: infillCellRight.left - width: UM.Theme.getSize("sidebar").width * .55 + width: Math.floor(UM.Theme.getSize("sidebar").width * .55) height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 Behavior on height { NumberAnimation { duration: 100 } } @@ -952,7 +952,7 @@ Item { id: tipsCell anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom) - anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height * 2) + anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2 anchors.left: parent.left width: parent.width height: tipsText.contentHeight * tipsText.lineCount diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index e3dfb85c49..0a6bb0835c 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -219,7 +219,7 @@ Rectangle anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.right: viewModeButton.right - property var buttonTarget: Qt.point(viewModeButton.x + viewModeButton.width / 2, viewModeButton.y + viewModeButton.height / 2) + property var buttonTarget: Qt.point(viewModeButton.x + Math.floor(viewModeButton.width / 2), viewModeButton.y + Math.floor(viewModeButton.height / 2)) height: childrenRect.height width: childrenRect.width diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index e454196409..0481bd5a4b 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -121,13 +121,13 @@ QtObject { Item { anchors.centerIn: parent - width: textLabel.width + icon.width + Theme.getSize("default_margin").width / 2 + width: textLabel.width + icon.width + Math.floor(Theme.getSize("default_margin").width / 2) Label { id: textLabel text: control.text anchors.right: icon.visible ? icon.left : parent.right - anchors.rightMargin: icon.visible ? Theme.getSize("default_margin").width / 2 : 0 + anchors.rightMargin: icon.visible ? Math.floor(Theme.getSize("default_margin").width / 2) : 0 anchors.verticalCenter: parent.verticalCenter; font: control.checked ? UM.Theme.getFont("large") : UM.Theme.getFont("large_nonbold") color: @@ -329,9 +329,9 @@ QtObject { UM.RecolorImage { id: tool_button_arrow anchors.right: parent.right; - anchors.rightMargin: (Theme.getSize("button").width - 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.bottomMargin: (Theme.getSize("button").height - 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 height: Theme.getSize("standard_arrow").height sourceSize.width: width @@ -669,7 +669,7 @@ QtObject { id: category_arrow anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: Theme.getSize("default_margin").width * 3 - width / 2 + anchors.rightMargin: Theme.getSize("default_margin").width * 3 - Math.floor(width / 2) width: Theme.getSize("standard_arrow").width height: Theme.getSize("standard_arrow").height sourceSize.width: width