| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2021 George Florea Bănuș <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: GPL-3.0-or-later |
| 5 |
*/ |
| 6 |
|
| 7 |
import QtQuick |
| 8 |
import QtQuick.Controls |
| 9 |
import QtQuick.Layouts |
| 10 |
|
| 11 |
RowLayout { |
| 12 |
id: root |
| 13 |
|
| 14 |
property int value: 0 |
| 15 |
signal sliderValueChanged(int value) |
| 16 |
|
| 17 |
Slider { |
| 18 |
id: slider |
| 19 |
|
| 20 |
from: -100 |
| 21 |
to: 100 |
| 22 |
value: root.value |
| 23 |
wheelEnabled: true |
| 24 |
stepSize: 1 |
| 25 |
onValueChanged: root.sliderValueChanged(value.toFixed(0)) |
| 26 |
|
| 27 |
Layout.fillWidth: true |
| 28 |
|
| 29 |
MouseArea { |
| 30 |
anchors.fill: parent |
| 31 |
acceptedButtons: Qt.MiddleButton |
| 32 |
onClicked: slider.value = 0 |
| 33 |
} |
| 34 |
|
| 35 |
Component.onCompleted: background.activeControl = "" |
| 36 |
} |
| 37 |
|
| 38 |
Label { |
| 39 |
text: slider.value |
| 40 |
horizontalAlignment: Qt.AlignHCenter |
| 41 |
Layout.preferredWidth: 40 |
| 42 |
} |
| 43 |
} |