mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 04:55:54 +08:00
Added shadow to slice button
CURA-5959
This commit is contained in:
parent
a1613c7f81
commit
3f4d379908
@ -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
|
||||
|
@ -87,28 +87,27 @@ Column
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("action_panel_button").height
|
||||
fixedWidthMode: true
|
||||
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
|
||||
|
||||
// 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"
|
||||
text:
|
||||
{
|
||||
if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1)
|
||||
{
|
||||
return catalog.i18nc("@button", "Slice")
|
||||
}
|
||||
return catalog.i18nc("@button", "Cancel")
|
||||
}
|
||||
enabled: !autoSlice && !disabledSlice
|
||||
visible: !autoSlice
|
||||
|
||||
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()
|
||||
}
|
||||
|
@ -173,6 +173,8 @@
|
||||
"action_button_disabled": [245, 245, 245, 255],
|
||||
"action_button_disabled_text": [127, 127, 127, 255],
|
||||
"action_button_disabled_border": [245, 245, 245, 255],
|
||||
"action_button_shadow": [64, 47, 205, 255],
|
||||
"action_button_disabled_shadow": [228, 228, 228, 255],
|
||||
|
||||
"print_button_ready": [50, 130, 255, 255],
|
||||
"print_button_ready_border": [50, 130, 255, 255],
|
||||
|
Loading…
x
Reference in New Issue
Block a user