mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-11 16:00:47 -07:00
parent
4bffa6d90f
commit
a1c252d3a2
73 changed files with 3047 additions and 1216 deletions
|
|
@ -7,14 +7,17 @@ import QtQuick.Controls 2.1
|
|||
import QtGraphicalEffects 1.0 // For the dropshadow
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Button
|
||||
{
|
||||
id: button
|
||||
property alias iconSource: buttonIcon.source
|
||||
property alias iconSource: buttonIconLeft.source
|
||||
property bool isIconOnRightSide: false
|
||||
property alias textFont: buttonText.font
|
||||
property alias cornerRadius: backgroundRect.radius
|
||||
property alias tooltip: tooltip.text
|
||||
property alias cornerSide: backgroundRect.cornerSide
|
||||
|
||||
property color color: UM.Theme.getColor("primary")
|
||||
property color hoverColor: UM.Theme.getColor("primary_hover")
|
||||
|
|
@ -36,18 +39,21 @@ Button
|
|||
// we elide the text to the right so the text will be cut off with the three dots at the end.
|
||||
property var fixedWidthMode: false
|
||||
|
||||
leftPadding: UM.Theme.getSize("default_margin").width
|
||||
rightPadding: UM.Theme.getSize("default_margin").width
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
|
||||
contentItem: Row
|
||||
{
|
||||
//Left side icon. Only displayed if !isIconOnRightSide.
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: buttonIcon
|
||||
id: buttonIconLeft
|
||||
source: ""
|
||||
height: Math.round(0.6 * parent.height)
|
||||
width: height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
height: buttonText.height
|
||||
width: visible ? height : 0
|
||||
color: button.hovered ? button.textHoverColor : button.textColor
|
||||
visible: source != ""
|
||||
visible: source != "" && !button.isIconOnRightSide
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
|
|
@ -64,11 +70,24 @@ Button
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
//Right side icon. Only displayed if isIconOnRightSide.
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: buttonIconRight
|
||||
source: buttonIconLeft.source
|
||||
height: buttonText.height
|
||||
width: visible ? height : 0
|
||||
color: buttonIconLeft.color
|
||||
visible: source != "" && button.isIconOnRightSide
|
||||
anchors.verticalCenter: buttonIconLeft.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
background: Cura.RoundedRectangle
|
||||
{
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue