mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 08:29:03 +08:00
Make some items' size dependent on parent's. Also make the ActionButton
more themable. Contributes to CURA-5784.
This commit is contained in:
parent
0a07f48375
commit
fdfa81b2b8
@ -30,6 +30,7 @@ Column
|
|||||||
id: information
|
id: information
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
renderType: Text.NativeRendering
|
||||||
text: loggedIn ? profile["username"] : catalog.i18nc("@label", "Please log in or create an account to\nenjoy all features of Ultimaker Cura.")
|
text: loggedIn ? profile["username"] : catalog.i18nc("@label", "Please log in or create an account to\nenjoy all features of Ultimaker Cura.")
|
||||||
font: loggedIn ? UM.Theme.getFont("large") : UM.Theme.getFont("default")
|
font: loggedIn ? UM.Theme.getFont("large") : UM.Theme.getFont("default")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
|
@ -21,7 +21,6 @@ Button
|
|||||||
{
|
{
|
||||||
id: avatar
|
id: avatar
|
||||||
|
|
||||||
|
|
||||||
width: Math.round(0.8 * parent.width)
|
width: Math.round(0.8 * parent.width)
|
||||||
height: Math.round(0.8 * parent.height)
|
height: Math.round(0.8 * parent.height)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
@ -11,28 +11,28 @@ Button
|
|||||||
{
|
{
|
||||||
id: button
|
id: button
|
||||||
property alias cursorShape: mouseArea.cursorShape
|
property alias cursorShape: mouseArea.cursorShape
|
||||||
property var iconSource: ""
|
property alias iconSource: buttonIcon.source
|
||||||
|
property alias textFont: buttonText.font
|
||||||
|
property alias cornerRadius: backgroundRect.radius
|
||||||
property var color: UM.Theme.getColor("primary")
|
property var color: UM.Theme.getColor("primary")
|
||||||
property var hoverColor: UM.Theme.getColor("primary_hover")
|
property var hoverColor: UM.Theme.getColor("primary_hover")
|
||||||
property var disabledColor: color
|
property var disabledColor: color
|
||||||
property var textColor: UM.Theme.getColor("button_text")
|
property var textColor: UM.Theme.getColor("button_text")
|
||||||
property var textHoverColor: UM.Theme.getColor("button_text_hover")
|
property var textHoverColor: UM.Theme.getColor("button_text_hover")
|
||||||
property var textDisabledColor: textColor
|
property var textDisabledColor: textColor
|
||||||
property var textFont: UM.Theme.getFont("action_button")
|
|
||||||
property var cornerRadius: 2 * screenScaleFactor
|
|
||||||
|
|
||||||
contentItem: Row
|
contentItem: Row
|
||||||
{
|
{
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
id: buttonIcon
|
id: buttonIcon
|
||||||
source: button.iconSource
|
source: ""
|
||||||
width: 16 * screenScaleFactor
|
height: Math.round(0.6 * parent.height)
|
||||||
height: 16 * screenScaleFactor
|
width: height
|
||||||
sourceSize.width: width
|
sourceSize.width: width
|
||||||
sourceSize.height: height
|
sourceSize.height: height
|
||||||
color: button.hovered ? button.textHoverColor : button.textColor
|
color: button.hovered ? button.textHoverColor : button.textColor
|
||||||
visible: button.iconSource != ""
|
visible: source != ""
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ Button
|
|||||||
id: buttonText
|
id: buttonText
|
||||||
text: button.text
|
text: button.text
|
||||||
color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor
|
color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor
|
||||||
font: button.textFont
|
font: UM.Theme.getFont("action_button")
|
||||||
visible: button.text != ""
|
visible: text != ""
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
@ -50,8 +50,9 @@ Button
|
|||||||
|
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
{
|
{
|
||||||
|
id: backgroundRect
|
||||||
color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor
|
color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor
|
||||||
radius: cornerRadius
|
radius: UM.Theme.getSize("action_button_radius").width
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea
|
MouseArea
|
||||||
|
@ -490,6 +490,8 @@
|
|||||||
|
|
||||||
"avatar_image": [6.8, 6.8],
|
"avatar_image": [6.8, 6.8],
|
||||||
|
|
||||||
|
"action_button_radius": [0.25, 0.25],
|
||||||
|
|
||||||
"drop_shadow_radius": [1.0, 1.0]
|
"drop_shadow_radius": [1.0, 1.0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user