Rename the properties to quickly identify that they are a boolean

Contributes to CURA-5984.
This commit is contained in:
Diego Prado Gesto 2018-11-28 09:44:37 +01:00
parent 14b460a626
commit c1c5eb2219
2 changed files with 12 additions and 8 deletions

View File

@ -61,8 +61,8 @@ Item
checked: model.active checked: model.active
enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled
topElement: toolsModel.getItem(0).id == model.id isTopElement: toolsModel.getItem(0).id == model.id
bottomElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id isBottomElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id
toolItem: UM.RecolorImage toolItem: UM.RecolorImage
{ {
@ -137,8 +137,8 @@ Item
delegate: ExtruderButton delegate: ExtruderButton
{ {
extruder: model extruder: model
topElement: extrudersModel.getItem(0).id == model.id isTopElement: extrudersModel.getItem(0).id == model.id
bottomElement: extrudersModel.getItem(extrudersModel.rowCount() - 1).id == model.id isBottomElement: extrudersModel.getItem(extrudersModel.rowCount() - 1).id == model.id
} }
} }
} }

View File

@ -12,8 +12,12 @@ Button
id: base id: base
property alias toolItem: contentItemLoader.sourceComponent property alias toolItem: contentItemLoader.sourceComponent
property bool topElement: false
property bool bottomElement: false // These two properties indicate whether the toolbar button is at the top of the toolbar column or at the bottom.
// If it is somewhere in the middle, then both has to be false. If there is only one element in the column, then
// both properties have to be set to true. This is used to create a rounded corner.
property bool isTopElement: false
property bool isBottomElement: false
hoverEnabled: true hoverEnabled: true
@ -49,7 +53,7 @@ Button
top: parent.top top: parent.top
} }
height: parent.radius height: parent.radius
color: base.topElement ? "transparent" : parent.color color: base.isTopElement ? "transparent" : parent.color
} }
Rectangle Rectangle
@ -62,7 +66,7 @@ Button
bottom: parent.bottom bottom: parent.bottom
} }
height: parent.radius height: parent.radius
color: base.bottomElement ? "transparent" : parent.color color: base.isBottomElement ? "transparent" : parent.color
} }
Rectangle Rectangle