ProgrammControl.qml 2.06 KB
Newer Older
Leander Schulten's avatar
Leander Schulten committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0
import custom.licht 1.0

ControlItem{
    id:item
    blockWidth: 3
    blockHeight: 1
    ControlItemBlock{
        Image {
            anchors.margins: 1
            anchors.fill:parent
            id: play
16
            source: "/icons/play.svg"
Leander Schulten's avatar
Leander Schulten committed
17
18
19
20
21
22
23
24
25
26
            Behavior on opacity {
                NumberAnimation{
                    duration: 100
                }
            }
        }
        Image {
            anchors.margins: 1
            anchors.fill:parent
            id: pause
27
            source: "/icons/pause.svg"
Leander Schulten's avatar
Leander Schulten committed
28
29
30
31
32
            opacity: 1-play.opacity
        }
        MouseArea{
            anchors.fill:parent

33
34
35
36
37
            onClicked: {
                controlData.programm.running = !controlData.programm.running;
                item.pressed = controlData.programm.running;
                play.opacity = !controlData.programm.running;
            }
Leander Schulten's avatar
Leander Schulten committed
38
39
40
41
42
43
44
45
46
47

        }
    }

    ControlItemBlock{
        blockWidth: 2
        Label{
            anchors.fill: parent
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
Leander Schulten's avatar
Leander Schulten committed
48
            text: controlData?controlData.programm.name:"null"
Leander Schulten's avatar
Leander Schulten committed
49
50
51
52
53
54
55
56
57
58
59
60
61
        }
    }

    popup: Popup{
            id:popup
            ColumnLayout{
                Label{
                    text:"Speed:"
                }
                Slider{
                    id:speedSlider
                    from: 0.1
                    to:10
Leander Schulten's avatar
Leander Schulten committed
62
                    value: controlData?controlData.programm.speed:1
Leander Schulten's avatar
Leander Schulten committed
63
64
65
66
67
68
69
70
71
72
73
74
75
                    onValueChanged: if(controlData)controlData.programm.speed = value;
                    Text {
                        id: sliderSpeed
                        text: speedSlider.value.toFixed(1)
                        anchors.bottom: speedSlider.handle.top
                        anchors.horizontalCenter: parent.handle.horizontalCenter
                        anchors.bottomMargin: 2
                    }
                }
            }
            closePolicy: Popup.CloseOnPressOutside
        }
}