MauiKit Image Tools

Ruler.qml
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5// import QtQuick.Extras
6// import QtQuick.Controls.Styles
7
8import org.mauikit.controls as Maui
9
10Slider
11{
12 id: control
13
14 live: false
15
16 leftPadding: 0
17 rightPadding: 0
18
19 implicitHeight: Maui.Style.toolBarHeight
20 // implicitWidth: width
21
22 background: Item
23 {
24 id: _bg
25 // Rectangle
26 // {
27 // anchors.fill: parent
28 // color: "pink"
29 // }
30
31
32 Loader
33 {
34 // anchors.fill: parent
35 asynchronous: true
36 sourceComponent: Row
37 {
38 spacing: 5
39 x: (control.horizontal ? control.visualPosition * (control.availableWidth - implicitWidth) : 0)
40 y: _bg.height/2 - implicitHeight/2
41
42 Repeater
43 {
44 // model: Math.abs(control.to) - Math.abs(control.from)
45 model: Math.abs(control.width/5)
46 Rectangle
47 {
48 color: Maui.Theme.textColor
49 height: 16
50 width: 1
51 opacity: index%10 === 0 ? 1: 0.5
52 // Text
53 // {
54 // property int correctIndex : control.from - index
55
56 // text: correctIndex
57 // visible: index%10 === 0
58 // color: "yellow"
59 // }
60 }
61
62 }
63 }
64 }
65 }
66
67 handle: ColumnLayout
68 {
69 id: handle
70 x: (control.horizontal ? control.visualPosition * (control.availableWidth - width) : 0)
71 y: 0
72 spacing: 0
73 width: 32
74 height: control.height
75 // implicitHeight: Maui.Style.iconSizes.medium
76
77 Label
78 {
79 // font.bold: true
80 // font.weight: Font.Bold
81 // anchors.horizontalCenter: parent.horizontalCenter
82 Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
83 // visible: control.pressed
84 font.pointSize: Maui.Style.fontSizes.tiny
85
86 // text: control.value
87 text: control.pressed ? control.valueAt(control.visualPosition ) : control.value
88 horizontalAlignment: Text.AlignHCenter
89 verticalAlignment: Text.AlignVCenter
90
91 // background: Rectangle
92 // {
93 // color: Maui.Theme.backgroundColor
94 // // radius: width/2
95 // }
96 }
97
98 Maui.Icon
99 {
100 Layout.alignment: Qt.AlignBottom| Qt.AlignHCenter
101 height: 32
102 width: height
103 color: Maui.Theme.textColor
104 isMask: true
105 source: "qrc:/assets/arrow-up.svg"
106 }
107
108 }
109}
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 11 2025 11:57:09 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.