MauiKit Image Tools

TransformationBar.qml
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import org.mauikit.controls as Maui
6
7ColumnLayout
8{
9 id: control
10
11 spacing: 0
12
13 property alias rotationSlider: _freeRotationSlider
14 // property alias rotationButton : _freeRotationButton
15 // property alias cropButton : _cropButton
16
17 Maui.ToolBar
18 {
19 position: ToolBar.Footer
20 Layout.fillWidth: true
21 background: Rectangle
22 {
23 color: Maui.Theme.backgroundColor
24 }
25
26 leftContent: [
27 ToolButton
28 {
29 icon.name: "object-flip-vertical"
30 text: i18nc("@action:button Mirror an image vertically", "Flip");
31 autoExclusive: true
32 onClicked: imageDoc.mirror(false, true);
33 },
34
35 ToolButton
36 {
37 icon.name: "object-flip-horizontal"
38 text: i18nc("@action:button Mirror an image horizontally", "Mirror");
39 checkable: true
40 autoExclusive: true
41 onClicked: imageDoc.mirror(true, false);
42 }
43
44 ]
45
46 rightContent: ToolButton
47 {
48 icon.name: "object-rotate-left"
49 // display: ToolButton.IconOnly
50 text: i18nc("@action:button Rotate an image 90°", "Rotate 90°");
51 onClicked:
52 {
53 let value = _freeRotationSlider.value-90
54 _freeRotationSlider.value = value < -180 ? 90 : value
55 }
56 }
57
58 // middleContent: Label
59 // {
60 // text: i18nd("mauikitimagetools","Rotate")
61 // }
62 }
63
64 Maui.ToolBar
65 {
66 id: _freeRotation
67
68 // visible: _freeRotationButton.checked
69 position: ToolBar.Footer
70 background: Rectangle
71 {
72 color: Maui.Theme.backgroundColor
73 }
74
75 Layout.fillWidth: true
76
77
78 middleContent: Ruler
79 {
80 id: _freeRotationSlider
81 live: true
82 Layout.fillWidth: true
83 from : -180
84 to: 180
85 value: 0
86 snapMode: Slider.SnapAlways
87 stepSize: 1
88 clip: true
89 }
90
91 leftContent: ToolButton
92 {
93 // text: i18nd("mauikitimagetools","Accept")
94
95 icon.name: "checkmark"
96 onClicked:
97 {
98 const value = _freeRotationSlider.value
99 _freeRotationSlider.value = 0
100
101 console.log("Rotate >> " , value)
102 imageDoc.rotate(value);
103
104
105 // if(_cropButton.checked)
106 // {
107 // crop()
108 // }
109 }
110 }
111
112 rightContent: ToolButton
113 {
114 // text: i18nd("mauikitimagetools","Cancel")
115 icon.name: "dialog-cancel"
116 onClicked:
117 {
118 if(_freeRotationButton.checked)
119 {
120 _freeRotationSlider.value = 0
121 _freeRotationButton.checked = false
122
123 }
124
125 if(_cropButton.checked)
126 {
127 _cropButton.checked = false
128 }
129 }
130 }
131 }
132
133 // Maui.ToolBar
134 // {
135 // position: ToolBar.Footer
136 // Layout.fillWidth: true
137 // background: Rectangle
138 // {
139 // color: Maui.Theme.backgroundColor
140 // }
141 // middleContent: Maui.ToolActions
142 // {
143 // autoExclusive: true
144 // Layout.alignment: Qt.AlignHCenter
145 // Action
146 // {
147 // id: _cropButton
148 // checkable: true
149 // icon.name: "transform-crop"
150 // text: i18nc("@action:button Crop an image", "Crop");
151 // }
152
153 // Action
154 // {
155 // id: _freeRotationButton
156 // icon.name: "transform-rotate"
157 // checkable: true
158 // text: i18nc("@action:button Rotate an image", "Rotate");
159 // }
160 // }
161
162 // leftContent: ToolButton
163 // {
164 // // text: i18nd("mauikitimagetools","Accept")
165 // visible: _freeRotationButton.checked || _cropButton.checked
166
167 // icon.name: "checkmark"
168 // onClicked:
169 // {
170 // if(_freeRotationButton.checked)
171 // {
172 // const value = _freeRotationSlider.value
173 // _freeRotationSlider.value = 0
174
175 // console.log("Rotate >> " , value)
176 // imageDoc.rotate(value);
177 // }
178
179 // // if(_cropButton.checked)
180 // // {
181 // // crop()
182 // // }
183 // }
184 // }
185
186 // rightContent: ToolButton
187 // {
188 // // text: i18nd("mauikitimagetools","Cancel")
189 // visible: _freeRotationButton.checked || _cropButton.checked
190 // icon.name: "dialog-cancel"
191 // onClicked:
192 // {
193 // if(_freeRotationButton.checked)
194 // {
195 // _freeRotationSlider.value = 0
196 // _freeRotationButton.checked = false
197
198 // }
199
200 // if(_cropButton.checked)
201 // {
202 // _cropButton.checked = false
203 // }
204 // }
205 // }
206 // }
207}
208
QString i18nc(const char *context, const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 11:56:08 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.