diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 22f93aa5f2..bf2a0e1283 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -42,7 +42,7 @@ Item { id: machineSelection z: openFileButtonBackground.z - 1 //Ensure that the tooltip of the open file button stays above the item row. - headerCornerSide: 2 // Show corners on the left. + headerCornerSide: Cura.RoundedRectangle.Direction.Left Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.fillWidth: true diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml index d6033d6272..29632e5f00 100644 --- a/plugins/PreviewStage/PreviewMenu.qml +++ b/plugins/PreviewStage/PreviewMenu.qml @@ -34,7 +34,7 @@ Item id: viewSelector iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") height: parent.height - headerCornerSide: 2 // Show corners on the left side + headerCornerSide: Cura.RoundedRectangle.Direction.Left property var viewModel: UM.ViewModel { } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 711c05c64c..2814bb9eb2 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -259,7 +259,7 @@ UM.MainWindow onHideTooltip: base.hideTooltip() width: UM.Theme.getSize("print_setup_widget").width height: UM.Theme.getSize("stage_menu").height - headerCornerSide: 4 // Show corners on the right side + headerCornerSide: RoundedRectangle.Direction.Right } } diff --git a/resources/qml/RoundedRectangle.qml b/resources/qml/RoundedRectangle.qml index d7ba7d6d13..9ad2230be5 100644 --- a/resources/qml/RoundedRectangle.qml +++ b/resources/qml/RoundedRectangle.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.7 import UM 1.2 as UM @@ -11,29 +11,39 @@ Item // As per regular rectangle property int radius: UM.Theme.getSize("default_radius").width - // On what side should the corners be shown 0 can be used if no radius is needed. + // On what side should the corners be shown 5 can be used if no radius is needed. // 1 is down, 2 is left, 3 is up and 4 is right. - property int cornerSide: 0 + property int cornerSide: RoundedRectangle.Direction.None + + enum Direction + { + None = 0, + Down = 1, + Left = 2, + Up = 3, + Right = 4, + All = 5 + } Rectangle { id: background anchors.fill: parent - radius: cornerSide != 0 ? parent.radius : 0 + radius: cornerSide != RoundedRectangle.Direction.None ? parent.radius : 0 color: parent.color } // The item that covers 2 of the corners to make them not rounded. Rectangle { - visible: cornerSide != 0 + visible: cornerSide != RoundedRectangle.Direction.None && cornerSide != RoundedRectangle.Direction.All height: cornerSide % 2 ? parent.radius: parent.height width: cornerSide % 2 ? parent.width : parent.radius color: parent.color anchors { - right: cornerSide == 2 ? parent.right: undefined - bottom: cornerSide == 3 ? parent.bottom: undefined + right: cornerSide == RoundedRectangle.Direction.Left ? parent.right: undefined + bottom: cornerSide == RoundedRectangle.Direction.Up ? parent.bottom: undefined } } }