Cura/resources/qml/ExtruderIcon.qml
Konstantinos Karmas c3f26d4daa Move layer.enabled inside the child item in ExtruderIcon
When it was in the outer item, it was causing the label to disappear when then extruder icon was getting disabled. Moving it inside the child item which has the opacity change seems to fix that issue.

CURA-8417
2021-08-05 09:52:03 +02:00

61 lines
1.7 KiB
QML

// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.11
import QtQuick.Controls 1.1
import UM 1.2 as UM
Item
{
id: extruderIconItem
implicitWidth: UM.Theme.getSize("extruder_icon").width
implicitHeight: UM.Theme.getSize("extruder_icon").height
property bool checked: true
property color materialColor
property alias textColor: extruderNumberText.color
property bool extruderEnabled: true
property alias iconSize: mainIcon.sourceSize
property string iconVariant: "medium"
Item
{
opacity: extruderEnabled ? 1 : UM.Theme.getColor("extruder_disabled").a
anchors.fill: parent
layer.enabled: true // Prevent weird opacity effects.
UM.RecolorImage
{
anchors.fill: parent
sourceSize: mainIcon.sourceSize
source: UM.Theme.getIcon("ExtruderColor", iconVariant)
color: materialColor
}
UM.RecolorImage
{
id: mainIcon
anchors.fill: parent
sourceSize: UM.Theme.getSize("extruder_icon")
source: UM.Theme.getIcon("Extruder", iconVariant)
color: extruderNumberText.color
}
Label
{
id: extruderNumberText
anchors.centerIn: parent
text: index + 1
font: UM.Theme.getFont("small_emphasis")
color: UM.Theme.getColor("text")
width: contentWidth
height: contentHeight
renderType: Text.NativeRendering
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}