Added shadow to slice button

CURA-5959
This commit is contained in:
Jaime van Kessel 2018-11-22 15:35:40 +01:00
parent a1613c7f81
commit 3f4d379908
3 changed files with 35 additions and 16 deletions

View file

@ -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