mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 07:23:13 +08:00
Change the color of a circle around the toolbar button
Instead of changing the color of the entire tool when it is hovered or selected, now a background circle will be drawn and its color will change according to whether the button is hovered/selected or not. In addition, the button icons will now be half the size of the button itself. CURA-8013
This commit is contained in:
parent
eeccfc32b9
commit
77a8f36153
@ -68,7 +68,7 @@ Item
|
|||||||
source: UM.Theme.getIcon(model.icon) != "" ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon
|
source: UM.Theme.getIcon(model.icon) != "" ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon
|
||||||
color: UM.Theme.getColor("icon")
|
color: UM.Theme.getColor("icon")
|
||||||
|
|
||||||
sourceSize: UM.Theme.getSize("button_icon")
|
sourceSize: Math.round(UM.Theme.getSize("button") / 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
onCheckedChanged:
|
onCheckedChanged:
|
||||||
|
@ -25,22 +25,7 @@ Button
|
|||||||
{
|
{
|
||||||
implicitWidth: UM.Theme.getSize("button").width
|
implicitWidth: UM.Theme.getSize("button").width
|
||||||
implicitHeight: UM.Theme.getSize("button").height
|
implicitHeight: UM.Theme.getSize("button").height
|
||||||
color:
|
color: UM.Theme.getColor("toolbar_background")
|
||||||
{
|
|
||||||
if (base.checked && base.hovered)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("toolbar_button_active_hover")
|
|
||||||
}
|
|
||||||
else if (base.checked)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("toolbar_button_active")
|
|
||||||
}
|
|
||||||
else if(base.hovered)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("toolbar_button_hover")
|
|
||||||
}
|
|
||||||
return UM.Theme.getColor("toolbar_background")
|
|
||||||
}
|
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
@ -84,16 +69,35 @@ Button
|
|||||||
color: parent.color
|
color: parent.color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
contentItem: Rectangle
|
||||||
contentItem: Item
|
|
||||||
{
|
{
|
||||||
opacity: parent.enabled ? 1.0 : 0.2
|
opacity: parent.enabled ? 1.0 : 0.2
|
||||||
|
implicitWidth: Math.round(UM.Theme.getSize("button").width * 0.75)
|
||||||
|
implicitHeight: Math.round(UM.Theme.getSize("button").height * 0.75)
|
||||||
|
radius: Math.round(width * 0.5)
|
||||||
|
|
||||||
|
color:
|
||||||
|
{
|
||||||
|
if (base.checked && base.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("toolbar_button_active_hover")
|
||||||
|
}
|
||||||
|
else if (base.checked)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("toolbar_button_active")
|
||||||
|
}
|
||||||
|
else if(base.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("toolbar_button_hover")
|
||||||
|
}
|
||||||
|
return UM.Theme.getColor("toolbar_background")
|
||||||
|
}
|
||||||
Loader
|
Loader
|
||||||
{
|
{
|
||||||
id: contentItemLoader
|
id: contentItemLoader
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: UM.Theme.getSize("button_icon").width
|
width: Math.round(UM.Theme.getSize("button").width / 2)
|
||||||
height: UM.Theme.getSize("button_icon").height
|
height: Math.round(UM.Theme.getSize("button").height / 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user