summaryrefslogtreecommitdiffstats
path: root/app/VolumeSlider.qml
blob: 130eed44f4f444f6fd81103e805db35b42da5908 (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
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0

RowLayout {
    property int value
    property string role
    signal sliderValueChanged(string role, int value)

    onRoleChanged: sliderName.text = role
    onValueChanged: {
        sliderValue.text = value + " %"
        sliderControl.value = value;
    }

    Layout.minimumHeight: 75
    Label {
        id: sliderName
        font.pixelSize: 24
        text: role
        Layout.minimumWidth: 150
    }
    Label {
        id: sliderValue
        font.pixelSize: 24
        text: "0 %"
    }
    Slider {
        id: sliderControl
        Layout.fillWidth: true
        from: 0
        to: 100
        stepSize: 1
        snapMode: Slider.SnapOnRelease
        onValueChanged: {
            sliderValue.text = value + " %";
            sliderValueChanged(role, value);
        }
    }
}