Remove 'roundedness' and 'shadow' from action-buttons.

Per the new UI design. Keep them as deprecated properties, so we may not need a major API/SDK increase just yet.

contributes to CURA-8012
This commit is contained in:
Remco Burema 2021-06-30 17:04:55 +02:00
parent 45977e109b
commit e5d77a46d6
No known key found for this signature in database
GPG key ID: 215C49431D43F98C
5 changed files with 50 additions and 36 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 Ultimaker B.V.
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
@ -18,7 +18,6 @@ Button
property alias textFont: buttonText.font
property alias cornerRadius: backgroundRect.radius
property alias tooltip: tooltip.tooltipText
property alias cornerSide: backgroundRect.cornerSide
property color color: UM.Theme.getColor("primary")
property color hoverColor: UM.Theme.getColor("primary_hover")
@ -29,8 +28,6 @@ Button
property color outlineColor: color
property color outlineHoverColor: hoverColor
property color outlineDisabledColor: outlineColor
property alias shadowColor: shadow.color
property alias shadowEnabled: shadow.visible
property alias busy: busyIndicator.visible
property bool underlineTextOnHover: false
@ -46,6 +43,49 @@ Button
// but it can exceed a maximum, then this value have to be set.
property int maximumWidth: 0
// These properties are deprecated.
// To (maybe) prevent a major SDK upgrade, mark them as deprecated instead of just outright removing them.
// Note, if you still want rounded corners, use (something based on) Cura.RoundedRectangle.
property alias cornerSide: deprecatedProperties.cornerSide
property alias shadowColor: deprecatedProperties.shadowColor
property alias shadowEnabled: deprecatedProperties.shadowEnabled
Item
{
id: deprecatedProperties
visible: false
enabled: false
width: 0
height: 0
property var cornerSide: null
property var shadowColor: null
property var shadowEnabled: null
onCornerSideChanged:
{
if (cornerSide != null)
{
CuraApplication.writeToLog("w", "'ActionButton.cornerSide' is deprecated since 4.11. Rounded corners can still be made with 'Cura.RoundedRectangle'.");
}
}
onShadowColorChanged:
{
if (shadowColor != null)
{
CuraApplication.writeToLog("w", "'ActionButton.shadowColor' is deprecated since 4.11.")
}
}
onShadowEnabledChanged:
{
if (shadowEnabled != null)
{
CuraApplication.writeToLog("w", "'ActionButton.shadowEnabled' is deprecated since 4.11.")
}
}
}
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
height: UM.Theme.getSize("action_button").height
@ -127,29 +167,14 @@ Button
}
}
background: Cura.RoundedRectangle
background: Rectangle
{
id: backgroundRect
cornerSide: Cura.RoundedRectangle.Direction.All
color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor
radius: UM.Theme.getSize("action_button_radius").width
border.width: UM.Theme.getSize("default_lining").width
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
}
Cura.ToolTip
{
id: tooltip
@ -189,4 +214,4 @@ Button
duration: 2500
}
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2018 Ultimaker B.V.
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
@ -23,7 +23,6 @@ Item
id: saveToButton
height: parent.height
fixedWidthMode: true
cornerSide: deviceSelectionMenu.visible ? Cura.RoundedRectangle.Direction.Left : Cura.RoundedRectangle.Direction.All
anchors
{
@ -48,10 +47,6 @@ Item
id: deviceSelectionMenu
height: parent.height
shadowEnabled: true
shadowColor: UM.Theme.getColor("primary_shadow")
cornerSide: Cura.RoundedRectangle.Direction.Right
anchors
{
top: parent.top

View file

@ -1,4 +1,4 @@
// Copyright (c) 2018 Ultimaker B.V.
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -9,8 +9,6 @@ import Cura 1.1 as Cura
Cura.ActionButton
{
shadowEnabled: true
shadowColor: enabled ? UM.Theme.getColor("primary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow")
color: UM.Theme.getColor("primary_button")
textColor: UM.Theme.getColor("primary_button_text")
outlineColor: "transparent"

View file

@ -1,4 +1,4 @@
// Copyright (c) 2018 Ultimaker B.V.
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -9,8 +9,6 @@ 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: UM.Theme.getColor("secondary_button")
textColor: UM.Theme.getColor("secondary_button_text")
outlineColor: "transparent"

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 Ultimaker B.V.
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -9,8 +9,6 @@ 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("text_link")
outlineColor: "transparent"