Checked all divisions (again..) and multiplications on rounding errors

CURA-4941
This commit is contained in:
Mark 2018-02-10 12:45:36 +01:00
parent b52bf6decf
commit 461da709ff
16 changed files with 38 additions and 38 deletions

View file

@ -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
{

View file

@ -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}

View file

@ -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;
}

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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:
{

View file

@ -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)

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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