mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Re-use Cura.ToolbarButton
in per object settings menu
CURA-8684
This commit is contained in:
parent
26bd68d891
commit
b51c787f62
@ -77,44 +77,60 @@ Item
|
||||
id: meshTypeButtons
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
ToolBarButton
|
||||
Cura.ToolbarButton
|
||||
{
|
||||
id: normalButton
|
||||
text: catalog.i18nc("@label", "Normal model")
|
||||
iconSource: UM.Theme.getIcon("Infill0");
|
||||
toolItem: UM.RecolorImage
|
||||
{
|
||||
source: UM.Theme.getIcon("Infill0")
|
||||
color: UM.Theme.getColor("icon")
|
||||
}
|
||||
property bool needBorder: true
|
||||
checkable: true
|
||||
onClicked: setMeshType(normalMeshType);
|
||||
z: 4
|
||||
}
|
||||
|
||||
ToolBarButton
|
||||
Cura.ToolbarButton
|
||||
{
|
||||
id: supportMeshButton
|
||||
text: catalog.i18nc("@label", "Print as support")
|
||||
iconSource: UM.Theme.getIcon("MeshTypeSupport");
|
||||
toolItem: UM.RecolorImage
|
||||
{
|
||||
source: UM.Theme.getIcon("MeshTypeSupport")
|
||||
color: UM.Theme.getColor("icon")
|
||||
}
|
||||
property bool needBorder: true
|
||||
checkable:true
|
||||
onClicked: setMeshType(supportMeshType)
|
||||
z: 3
|
||||
}
|
||||
|
||||
ToolBarButton
|
||||
Cura.ToolbarButton
|
||||
{
|
||||
id: overlapMeshButton
|
||||
text: catalog.i18nc("@label", "Modify settings for overlaps")
|
||||
iconSource: UM.Theme.getIcon("MeshTypeIntersect");
|
||||
toolItem: UM.RecolorImage
|
||||
{
|
||||
source: UM.Theme.getIcon("MeshTypeIntersect")
|
||||
color: UM.Theme.getColor("icon")
|
||||
}
|
||||
property bool needBorder: true
|
||||
checkable:true
|
||||
onClicked: setMeshType(infillMeshType)
|
||||
z: 2
|
||||
}
|
||||
|
||||
ToolBarButton
|
||||
Cura.ToolbarButton
|
||||
{
|
||||
id: antiOverhangMeshButton
|
||||
text: catalog.i18nc("@label", "Don't support overlaps")
|
||||
iconSource: UM.Theme.getIcon("BlockSupportOverlaps");
|
||||
toolItem: UM.RecolorImage
|
||||
{
|
||||
source: UM.Theme.getIcon("BlockSupportOverlaps")
|
||||
color: UM.Theme.getColor("icon")
|
||||
}
|
||||
property bool needBorder: true
|
||||
checkable: true
|
||||
onClicked: setMeshType(antiOverhangMeshType)
|
||||
|
@ -1,79 +0,0 @@
|
||||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 2.1
|
||||
|
||||
import Cura 1.0 as Cura
|
||||
import UM 1.5 as UM
|
||||
|
||||
Button
|
||||
{
|
||||
id: base
|
||||
|
||||
property alias tooltip: tooltip.text
|
||||
property alias iconSource: icon.source;
|
||||
|
||||
Cura.ToolTip
|
||||
{
|
||||
id: tooltip
|
||||
visible: base.hovered
|
||||
targetPoint: Qt.point(parent.x, Math.round(parent.y + parent.height / 2))
|
||||
}
|
||||
|
||||
|
||||
background: Item
|
||||
{
|
||||
implicitWidth: UM.Theme.getSize("button").width
|
||||
implicitHeight: UM.Theme.getSize("button").height
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: buttonFace
|
||||
|
||||
anchors.fill: parent
|
||||
property bool down: base.pressed || (base.checkable && base.checked)
|
||||
|
||||
color:
|
||||
{
|
||||
if(base.customColor !== undefined && base.customColor !== null)
|
||||
{
|
||||
return base.customColor
|
||||
}
|
||||
else if(base.checkable && base.checked && base.hovered)
|
||||
{
|
||||
return UM.Theme.getColor("toolbar_button_active_hover")
|
||||
}
|
||||
else if(base.pressed || (base.checkable && 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")
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50 } }
|
||||
|
||||
border.width: (base.hasOwnProperty("needBorder") && base.needBorder) ? UM.Theme.getSize("default_lining").width : 0
|
||||
border.color: base.checked ? UM.Theme.getColor("icon") : UM.Theme.getColor("lining")
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: icon
|
||||
|
||||
anchors.centerIn: parent
|
||||
opacity: base.enabled ? 1.0 : 0.2
|
||||
width: UM.Theme.getSize("medium_button_icon").width
|
||||
height: UM.Theme.getSize("medium_button_icon").height
|
||||
color: UM.Theme.getColor("icon")
|
||||
|
||||
sourceSize: UM.Theme.getSize("medium_button_icon")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user