aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DoubleSpinBox.qml
blob: a44e8c690bec388840b351337fbbaa324dbc7e42 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQuick 2.15
import StudioControls 1.0 as StudioControls

Item {
    id: wrapper

    property alias decimals: spinBox.decimals
    property alias hasSlider: spinBox.hasSlider
    property alias value: spinBox.realValue
    property alias minimumValue: spinBox.realFrom
    property alias maximumValue: spinBox.realTo
    property alias stepSize: spinBox.realStepSize
    property alias spinBoxIndicatorVisible: spinBox.spinBoxIndicatorVisible
    property alias sliderIndicatorVisible: spinBox.sliderIndicatorVisible
    property alias hover: spinBox.hover
    property alias inputHAlignment: spinBox.inputHAlignment

    property alias pixelsPerUnit: spinBox.pixelsPerUnit

    signal valueModified
    signal dragStarted
    signal indicatorPressed

    width: 90
    implicitHeight: spinBox.height

    onFocusChanged: restoreCursor()

    StudioControls.RealSpinBox {
        id: spinBox

        __devicePixelRatio: devicePixelRatio()

        onDragStarted: {
            hideCursor()
            wrapper.dragStarted()
        }
        onDragEnded: restoreCursor()
        onDragging: holdCursorInPlace()
        onIndicatorPressed: wrapper.indicatorPressed()

        property bool hasSlider: spinBox.sliderIndicatorVisible

        width: wrapper.width
        actionIndicatorVisible: false

        realFrom: 0.0
        realTo: 1.0
        realStepSize: 0.1
        decimals: 2

        onRealValueModified: wrapper.valueModified()
    }
}