Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/AppletAppearance.qml
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 192 | KQuickControlsAddons.MouseEventListener { | |||
---|---|---|---|---|---|
198 | property int pressY: -1 | 198 | property int pressY: -1 | ||
199 | 199 | | |||
200 | // for animations | 200 | // for animations | ||
201 | property int endHeight: minimumHeight | 201 | property int endHeight: minimumHeight | ||
202 | property int endWidth: minimumWidth | 202 | property int endWidth: minimumWidth | ||
203 | property int endX: 0 | 203 | property int endX: 0 | ||
204 | property int endY: 0 | 204 | property int endY: 0 | ||
205 | 205 | | |||
206 | function startDrag(mouse) { | ||||
207 | dragMouseArea.dragging = true; | ||||
208 | | ||||
209 | eventGenerator.sendGrabEventRecursive(appletItem, KQuickControlsAddons.EventGenerator.UngrabMouse); | ||||
210 | eventGenerator.sendGrabEvent(dragMouseArea, KQuickControlsAddons.EventGenerator.GrabMouse); | ||||
211 | eventGenerator.sendMouseEvent(dragMouseArea, KQuickControlsAddons.EventGenerator.MouseButtonPress, mouse.x, mouse.y, Qt.LeftButton, Qt.LeftButton, 0); | ||||
212 | } | ||||
213 | | ||||
206 | height: endHeight | 214 | height: endHeight | ||
207 | width: endWidth | 215 | width: endWidth | ||
208 | z: 10 | 216 | z: 10 | ||
209 | 217 | | |||
210 | hoverEnabled: true | 218 | hoverEnabled: true | ||
211 | 219 | | |||
212 | onPressed: { | 220 | onPressed: { | ||
221 | if (!plasmoid.immutable && mouse.modifiers == Qt.AltModifier) { | ||||
222 | if (!dragMouseArea.dragging) { | ||||
223 | startDrag(mouse) | ||||
224 | } | ||||
225 | | ||||
226 | return; | ||||
227 | } | ||||
228 | | ||||
213 | pressX = mouse.x; | 229 | pressX = mouse.x; | ||
214 | pressY = mouse.y; | 230 | pressY = mouse.y; | ||
215 | } | 231 | } | ||
216 | 232 | | |||
217 | onPressAndHold: { | 233 | onPressAndHold: { | ||
218 | if (!plasmoid.immutable && plasmoid.configuration.pressToMove) { | 234 | if (!plasmoid.immutable && plasmoid.configuration.pressToMove) { | ||
219 | if (!dragMouseArea.dragging && !root.isDrag(pressX, pressY, mouse.x, mouse.y)) { | 235 | if (!dragMouseArea.dragging && !root.isDrag(pressX, pressY, mouse.x, mouse.y)) { | ||
220 | temporaryShowAppletHandle = true; | 236 | temporaryShowAppletHandle = true; | ||
221 | 237 | | |||
222 | dragMouseArea.dragging = true; | 238 | startDrag(mouse) | ||
223 | | ||||
224 | eventGenerator.sendGrabEventRecursive(appletItem, KQuickControlsAddons.EventGenerator.UngrabMouse); | | |||
225 | eventGenerator.sendGrabEvent(dragMouseArea, KQuickControlsAddons.EventGenerator.GrabMouse); | | |||
226 | eventGenerator.sendMouseEvent(dragMouseArea, KQuickControlsAddons.EventGenerator.MouseButtonPress, mouse.x, mouse.y, Qt.LeftButton, Qt.LeftButton, 0); | | |||
227 | } | 239 | } | ||
228 | } | 240 | } | ||
229 | 241 | | |||
230 | pressX = -1; | 242 | pressX = -1; | ||
231 | pressY = -1; | 243 | pressY = -1; | ||
232 | } | 244 | } | ||
233 | 245 | | |||
234 | onContainsMouseChanged: { | 246 | onContainsMouseChanged: { | ||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |