Просмотр исходного кода

Rename the properties to quickly identify that they are a boolean

Contributes to CURA-5984.
Diego Prado Gesto 6 лет назад
Родитель
Сommit
c1c5eb2219
2 измененных файлов с 12 добавлено и 8 удалено
  1. 4 4
      resources/qml/Toolbar.qml
  2. 8 4
      resources/qml/ToolbarButton.qml

+ 4 - 4
resources/qml/Toolbar.qml

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

+ 8 - 4
resources/qml/ToolbarButton.qml

@@ -12,8 +12,12 @@ Button
     id: base
 
     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
 
@@ -49,7 +53,7 @@ Button
                 top: parent.top
             }
             height: parent.radius
-            color: base.topElement ? "transparent" : parent.color
+            color: base.isTopElement ? "transparent" : parent.color
         }
 
         Rectangle
@@ -62,7 +66,7 @@ Button
                 bottom: parent.bottom
             }
             height: parent.radius
-            color: base.bottomElement ? "transparent" : parent.color
+            color: base.isBottomElement ? "transparent" : parent.color
         }
 
         Rectangle