Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ExtruderIcon.qml « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 87e210e75a0321baf97445b49fb998cb559a4ebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.7
import QtQuick.Controls 1.1
import UM 1.2 as UM

Item
{
    id: extruderIconItem

    implicitWidth: UM.Theme.getSize("button").width
    implicitHeight: implicitWidth

    property bool checked: true
    property color materialColor
    property alias textColor: extruderNumberText.color
    property bool extruderEnabled: true
    UM.RecolorImage
    {
        id: mainIcon
        anchors.fill: parent

        sourceSize.width: parent.width
        sourceSize.height: parent.width
        source: UM.Theme.getIcon("extruder_button")
        color: extruderEnabled ? materialColor: "gray"
    }

    Rectangle
    {
        id: extruderNumberCircle

        width: height
        height: Math.round(parent.height / 2)
        radius: Math.round(width / 2)
        color: UM.Theme.getColor("toolbar_background")

        anchors
        {
            horizontalCenter: parent.horizontalCenter
            top: parent.top
            // The circle needs to be slightly off center (so it sits in the middle of the square bit of the icon)
            topMargin: (parent.height - height) / 2 - 0.1 * parent.height
        }

        Label
        {
            id: extruderNumberText
            anchors.centerIn: parent
            text: index + 1
            font: UM.Theme.getFont("default")
            width: contentWidth
            height: contentHeight
            visible: extruderEnabled
        }

        UM.RecolorImage
        {
            id: disabledIcon
            anchors.fill: parent
            anchors.margins: UM.Theme.getSize("thick_lining").width
            sourceSize.width: width
            sourceSize.height: width
            source: UM.Theme.getIcon("cross1")
            visible: !extruderEnabled
            color: "black"
        }
    }
}