File: CameraButton.qml

package info (click to toggle)
cura 5.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 122,888 kB
  • sloc: python: 44,572; sh: 81; xml: 32; makefile: 16
file content (49 lines) | stat: -rw-r--r-- 1,280 bytes parent folder | download
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
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.3
import QtQuick.Controls 2.4
import UM 1.3 as UM
import Cura 1.0 as Cura

Button
{
    property var iconSource: null
    width: UM.Theme.getSize("button").width * 0.75 //Matching the size of the content of tool buttons.
    height: UM.Theme.getSize("button").height * 0.75

    hoverEnabled: true

    background: Rectangle
    {
        anchors.fill: parent
        radius: 0.5 * width
        color: parent.enabled ? (parent.hovered ? UM.Theme.getColor("monitor_card_hover") : "transparent") : UM.Theme.getColor("monitor_icon_disabled")
    }

    UM.ColorImage
    {
        id: icon
        anchors
        {
            horizontalCenter: parent.horizontalCenter
            verticalCenter: parent.verticalCenter
        }
        color: enabled ? UM.Theme.getColor("primary") : UM.Theme.getColor("main_background")
        height: width
        source: iconSource
        width: Math.round(parent.width / 2)
    }

    onClicked:
    {
        if (OutputDevice.activeCameraUrl != "")
        {
            OutputDevice.setActiveCameraUrl("")
        }
        else
        {
            OutputDevice.setActiveCameraUrl(modelData.cameraUrl)
        }
    }
}