mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Added enum for the roundedCorner property
This makes it a whole lot easier to read what is being set. CURA-5785
This commit is contained in:
parent
b826a42026
commit
eef6ad662d
4 changed files with 20 additions and 10 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue