Changeset View
Changeset View
Standalone View
Standalone View
examples/gallery/contents/ui/gallery/SliderGallery.qml
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.0 | 20 | import QtQuick 2.0 | ||
21 | import QtQuick.Controls 1.2 as Controls | 21 | import QtQuick.Controls 2.0 as Controls | ||
22 | import QtQuick.Layouts 1.2 | 22 | import QtQuick.Layouts 1.2 | ||
23 | import org.kde.kirigami 1.0 | 23 | import org.kde.kirigami 2.0 | ||
24 | 24 | | |||
25 | ScrollablePage { | 25 | ScrollablePage { | ||
26 | id: page | 26 | id: page | ||
27 | Layout.fillWidth: true | 27 | Layout.fillWidth: true | ||
28 | 28 | | |||
29 | title: "Sliders" | 29 | title: "Sliders" | ||
30 | 30 | | |||
31 | actions { | 31 | actions { | ||
Show All 22 Lines | 51 | Item { | |||
54 | ColumnLayout { | 54 | ColumnLayout { | ||
55 | anchors.centerIn: parent | 55 | anchors.centerIn: parent | ||
56 | spacing: Units.smallSpacing | 56 | spacing: Units.smallSpacing | ||
57 | 57 | | |||
58 | Label { | 58 | Label { | ||
59 | text: "Normal:" | 59 | text: "Normal:" | ||
60 | } | 60 | } | ||
61 | Controls.Slider { | 61 | Controls.Slider { | ||
62 | id: slider | ||||
62 | Layout.minimumWidth: Units.gridUnit * 15 | 63 | Layout.minimumWidth: Units.gridUnit * 15 | ||
63 | value: 2 | 64 | value: 2 | ||
64 | maximumValue: 5.0 | 65 | to: 5.0 | ||
66 | Controls.ToolTip { | ||||
67 | parent: slider.handle | ||||
68 | visible: slider.pressed | ||||
69 | text: slider.position.toFixed(1) | ||||
70 | } | ||||
65 | } | 71 | } | ||
66 | Label { | 72 | Label { | ||
67 | text: "Disabled:" | 73 | text: "Disabled:" | ||
68 | } | 74 | } | ||
69 | Controls.Slider { | 75 | Controls.Slider { | ||
70 | enabled: false | 76 | enabled: false | ||
71 | Layout.minimumWidth: Units.gridUnit * 15 | 77 | Layout.minimumWidth: Units.gridUnit * 15 | ||
72 | value: 2 | 78 | value: 2 | ||
73 | maximumValue: 5.0 | 79 | to: 5.0 | ||
74 | } | 80 | } | ||
75 | Label { | 81 | Label { | ||
76 | text: "Thickmarks:" | 82 | text: "Thickmarks:" | ||
77 | } | 83 | } | ||
78 | Controls.Slider { | 84 | Controls.Slider { | ||
85 | id: slider2 | ||||
79 | Layout.minimumWidth: Units.gridUnit * 15 | 86 | Layout.minimumWidth: Units.gridUnit * 15 | ||
80 | tickmarksEnabled: true | 87 | to: 5.0 | ||
81 | maximumValue: 5.0 | | |||
82 | stepSize: 1.0 | 88 | stepSize: 1.0 | ||
83 | value: 3 | 89 | value: 3 | ||
90 | Controls.ToolTip { | ||||
91 | parent: slider2.handle | ||||
92 | visible: slider2.pressed | ||||
93 | text: slider2.position.toFixed(1) | ||||
94 | } | ||||
84 | } | 95 | } | ||
85 | Label { | 96 | Label { | ||
86 | text: "Vertical:" | 97 | text: "Vertical:" | ||
87 | } | 98 | } | ||
88 | RowLayout { | 99 | RowLayout { | ||
89 | Layout.alignment: Qt.AlignHCenter | 100 | Layout.alignment: Qt.AlignHCenter | ||
90 | Controls.Slider { | 101 | Controls.Slider { | ||
91 | Layout.minimumWidth: 2 | 102 | Layout.minimumWidth: 2 | ||
92 | Layout.minimumHeight: Units.gridUnit * 10 | 103 | Layout.minimumHeight: Units.gridUnit * 10 | ||
93 | value: 2 | 104 | value: 2 | ||
94 | maximumValue: 5.0 | 105 | to: 5.0 | ||
95 | orientation: Qt.Vertical | 106 | orientation: Qt.Vertical | ||
96 | } | 107 | } | ||
97 | Controls.Slider { | 108 | Controls.Slider { | ||
98 | Layout.minimumWidth: 2 | 109 | Layout.minimumWidth: 2 | ||
99 | Layout.minimumHeight: Units.gridUnit * 10 | 110 | Layout.minimumHeight: Units.gridUnit * 10 | ||
100 | value: 3 | 111 | value: 3 | ||
101 | tickmarksEnabled: true | 112 | to: 5.0 | ||
102 | maximumValue: 5.0 | | |||
103 | stepSize: 1.0 | 113 | stepSize: 1.0 | ||
104 | orientation: Qt.Vertical | 114 | orientation: Qt.Vertical | ||
105 | } | 115 | } | ||
106 | } | 116 | } | ||
107 | } | 117 | } | ||
108 | } | 118 | } | ||
109 | } | 119 | } | ||
110 | } | 120 | } | ||
111 | 121 | |