diff options
author | Jaime van Kessel <nallath@gmail.com> | 2018-11-22 17:35:40 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2018-11-22 17:35:40 +0300 |
commit | 3f4d379908add0ec7054eb65e87ae91587ffaebd (patch) | |
tree | f32ad142716c375e15fd1d73c3153b5af7d5cdae /resources/qml | |
parent | a1613c7f816c0d9c10659972f32bbed3a1995ea1 (diff) |
Added shadow to slice button
CURA-5959
Diffstat (limited to 'resources/qml')
-rw-r--r-- | resources/qml/ActionButton.qml | 18 | ||||
-rw-r--r-- | resources/qml/ActionPanel/SliceProcessWidget.qml | 23 |
2 files changed, 29 insertions, 12 deletions
diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 69d65e1c3f..8cd53b5d7e 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -5,6 +5,8 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.0 // For the dropshadow + import UM 1.1 as UM Button @@ -26,6 +28,9 @@ Button property color outlineHoverColor: hoverColor property color outlineDisabledColor: outlineColor + property alias shadowColor: shadow.color + property alias shadowEnabled: shadow.visible + // This property is used to indicate whether the button has a fixed width or the width would depend on the contents // Be careful when using fixedWidthMode, the translated texts can be too long that they won't fit. In any case, // we elide the text to the right so the text will be cut off with the three dots at the end. @@ -70,6 +75,19 @@ Button border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor } + DropShadow + { + id: shadow + // Don't blur the shadow + radius: 0 + anchors.fill: backgroundRect + source: backgroundRect + verticalOffset: 2 + visible: false + // Should always be drawn behind the background. + z: backgroundRect.z - 1 + } + ToolTip { id: tooltip diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 2d4a7b6b89..4f10e6879b 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -87,28 +87,27 @@ Column width: parent.width height: UM.Theme.getSize("action_panel_button").height fixedWidthMode: true + + // Get the current value from the preferences + property bool autoSlice: UM.Preferences.getValue("general/auto_slice") + // Disable the slice process when + property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error].indexOf(widget.backendState) != -1 + text: { if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1) { return catalog.i18nc("@button", "Slice") } - if (autoSlice) - { - return catalog.i18nc("@button", "Auto slicing...") - } return catalog.i18nc("@button", "Cancel") } enabled: !autoSlice && !disabledSlice + visible: !autoSlice - // Get the current value from the preferences - property bool autoSlice: UM.Preferences.getValue("general/auto_slice") - // Disable the slice process when - property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error].indexOf(widget.backendState) != -1 - - disabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled") : "transparent" - textDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_text") : UM.Theme.getColor("primary") - outlineDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_border") : "transparent" + disabledColor: UM.Theme.getColor("action_button_disabled") + textDisabledColor: UM.Theme.getColor("action_button_disabled_text") + shadowEnabled: true + shadowColor: enabled ? UM.Theme.getColor("action_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") onClicked: sliceOrStopSlicing() } |