aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/effects/EffectSlider.qml
blob: cdfee311c574369edc5b601d84bb31963a15a9f3 (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
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

ColumnLayout {
    property string description
    property int precision: 2
    property bool exponential: false
    property double expValue: exponential ? Math.pow(2.0, sliderValue) : sliderValue
    property alias sliderValue: slider.value
    property alias fromValue: slider.from
    property alias toValue: slider.to

    Slider {
        id: slider
        from: 0.0
        to: 1.0
        value: 0.5
    }

    Text {
        Layout.alignment: Qt.AlignHCenter
        text: (parent.description.length == 0 ? "" : parent.description + ": ")
                   + parent.expValue.toFixed(precision);
    }
}