Browse Source

Add tertiary button as a reusable component

CURA-7418
Jaime van Kessel 4 years ago
parent
commit
200e3d6ee7
2 changed files with 31 additions and 0 deletions
  1. 10 0
      resources/qml/ActionButton.qml
  2. 21 0
      resources/qml/TertiaryButton.qml

+ 10 - 0
resources/qml/ActionButton.qml

@@ -33,6 +33,8 @@ Button
     property alias shadowEnabled: shadow.visible
     property alias busy: busyIndicator.visible
 
+    property bool underlineTextOnHover: false
+
     property alias toolTipContentAlignment: tooltip.contentAlignment
 
     // This property is used to indicate whether the button has a fixed width or the width would depend on the contents
@@ -49,6 +51,14 @@ Button
     height: UM.Theme.getSize("action_button").height
     hoverEnabled: true
 
+    onHoveredChanged:
+    {
+        if(underlineTextOnHover)
+        {
+            buttonText.font.underline = hovered
+        }
+    }
+
     contentItem: Row
     {
         spacing: UM.Theme.getSize("narrow_margin").width

+ 21 - 0
resources/qml/TertiaryButton.qml

@@ -0,0 +1,21 @@
+// Copyright (c) 2020 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
+import QtQuick 2.2
+
+import UM 1.4 as UM
+import Cura 1.1 as Cura
+
+
+Cura.ActionButton
+{
+    shadowEnabled: true
+    shadowColor: enabled ? UM.Theme.getColor("secondary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow")
+    color: "transparent"
+    textColor: UM.Theme.getColor("secondary_button_text")
+    outlineColor: "transparent"
+    disabledColor: UM.Theme.getColor("action_button_disabled")
+    textDisabledColor: UM.Theme.getColor("action_button_disabled_text")
+    hoverColor: "transparent"
+    underlineTextOnHover: true
+}