mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 20:43:16 +08:00
Add icons on left and right side of text
For this I had to implement functionality in ActionButton to be able to display the icon on either side. Contributes to issue CURA-5876.
This commit is contained in:
parent
dca286cea5
commit
d42ddad606
@ -11,7 +11,8 @@ Button
|
||||
{
|
||||
id: button
|
||||
property alias cursorShape: mouseArea.cursorShape
|
||||
property alias iconSource: buttonIcon.source
|
||||
property alias iconSource: buttonIconLeft.source
|
||||
property var iconOnRightSide: false
|
||||
property alias textFont: buttonText.font
|
||||
property alias cornerRadius: backgroundRect.radius
|
||||
property alias tooltip: tooltip.text
|
||||
@ -35,16 +36,17 @@ Button
|
||||
|
||||
contentItem: Row
|
||||
{
|
||||
//Icon if displayed on the left side.
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: buttonIcon
|
||||
id: buttonIconLeft
|
||||
source: ""
|
||||
height: Math.round(0.6 * parent.height)
|
||||
width: height
|
||||
width: visible ? height : 0
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: button.hovered ? button.textHoverColor : button.textColor
|
||||
visible: source != ""
|
||||
visible: source != "" && !button.iconOnRightSide
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
@ -61,6 +63,20 @@ Button
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
//Icon if displayed on the right side.
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: buttonIconRight
|
||||
source: buttonIconLeft.source
|
||||
height: Math.round(0.6 * parent.height)
|
||||
width: visible ? height : 0
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: button.hovered ? button.textHoverColor : button.textColor
|
||||
visible: source != "" && button.iconOnRightSide
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
|
@ -172,6 +172,9 @@ Cura.ExpandableComponent
|
||||
textColor: UM.Theme.getColor("primary")
|
||||
textHoverColor: UM.Theme.getColor("text")
|
||||
|
||||
iconSource: UM.Theme.icons.arrow_right
|
||||
iconOnRightSide: true
|
||||
|
||||
onClicked: popupItem.configuration_method = "custom"
|
||||
}
|
||||
|
||||
@ -192,6 +195,8 @@ Cura.ExpandableComponent
|
||||
textColor: UM.Theme.getColor("primary")
|
||||
textHoverColor: UM.Theme.getColor("text")
|
||||
|
||||
iconSource: UM.Theme.icons.arrow_left
|
||||
|
||||
onClicked: popupItem.configuration_method = "auto"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user