Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/FolderItemDelegate.qml
Show All 36 Lines | 30 | Item { | |||
---|---|---|---|---|---|
37 | property QtObject popupDialog: loader.item ? loader.item.popupDialog : null | 37 | property QtObject popupDialog: loader.item ? loader.item.popupDialog : null | ||
38 | property Item iconArea: loader.item ? loader.item.iconArea : null | 38 | property Item iconArea: loader.item ? loader.item.iconArea : null | ||
39 | property Item label: loader.item ? loader.item.label : null | 39 | property Item label: loader.item ? loader.item.label : null | ||
40 | property Item labelArea: loader.item ? loader.item.labelArea : null | 40 | property Item labelArea: loader.item ? loader.item.labelArea : null | ||
41 | property Item actionsOverlay: loader.item ? loader.item.actionsOverlay : null | 41 | property Item actionsOverlay: loader.item ? loader.item.actionsOverlay : null | ||
42 | property Item hoverArea: loader.item ? loader.item.hoverArea : null | 42 | property Item hoverArea: loader.item ? loader.item.hoverArea : null | ||
43 | property Item frame: loader.item ? loader.item.frame : null | 43 | property Item frame: loader.item ? loader.item.frame : null | ||
44 | property Item toolTip: loader.item ? loader.item.toolTip : null | 44 | property Item toolTip: loader.item ? loader.item.toolTip : null | ||
45 | property bool touchTap: false | ||||
45 | Accessible.name: name | 46 | Accessible.name: name | ||
46 | Accessible.role: Accessible.Canvas | 47 | Accessible.role: Accessible.Canvas | ||
47 | 48 | | |||
48 | function openPopup() { | 49 | function openPopup() { | ||
49 | if (isDir) { | 50 | if (isDir) { | ||
50 | loader.item.openPopup(); | 51 | loader.item.openPopup(); | ||
51 | } | 52 | } | ||
52 | } | 53 | } | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 85 | Item { | |||
153 | PlasmaCore.ToolTipArea { | 154 | PlasmaCore.ToolTipArea { | ||
154 | id: toolTip | 155 | id: toolTip | ||
155 | 156 | | |||
156 | active: (plasmoid.configuration.toolTips && popupDialog == null && !model.blank) | 157 | active: (plasmoid.configuration.toolTips && popupDialog == null && !model.blank) | ||
157 | interactive: false | 158 | interactive: false | ||
158 | location: root.useListViewMode ? (plasmoid.location === PlasmaCore.Types.LeftEdge ? PlasmaCore.Types.LeftEdge : PlasmaCore.Types.RightEdge) : plasmoid.location | 159 | location: root.useListViewMode ? (plasmoid.location === PlasmaCore.Types.LeftEdge ? PlasmaCore.Types.LeftEdge : PlasmaCore.Types.RightEdge) : plasmoid.location | ||
159 | 160 | | |||
160 | onContainsMouseChanged: { | 161 | onContainsMouseChanged: { | ||
161 | if (containsMouse && !model.blank) { | 162 | if ((containsMouse || touchTap) && !model.blank) { | ||
162 | if (toolTip.active) { | 163 | if (toolTip.active) { | ||
163 | toolTip.icon = model.decoration; | 164 | toolTip.icon = model.decoration; | ||
164 | toolTip.mainText = model.display; | 165 | toolTip.mainText = model.display; | ||
165 | 166 | | |||
166 | if (model.size !== undefined) { | 167 | if (model.size !== undefined) { | ||
167 | toolTip.subText = model.type + "\n" + model.size; | 168 | toolTip.subText = model.type + "\n" + model.size; | ||
168 | } else { | 169 | } else { | ||
169 | toolTip.subText = model.type; | 170 | toolTip.subText = model.type; | ||
Show All 32 Lines | 202 | PropertyChanges { | |||
202 | target: toolTip | 203 | target: toolTip | ||
203 | x: frameLoader.x | 204 | x: frameLoader.x | ||
204 | y: frameLoader.y | 205 | y: frameLoader.y | ||
205 | width: frameLoader.width | 206 | width: frameLoader.width | ||
206 | height: frameLoader.height | 207 | height: frameLoader.height | ||
207 | } | 208 | } | ||
208 | } | 209 | } | ||
209 | ] | 210 | ] | ||
211 | | ||||
212 | MouseArea { | ||||
mart: How much of this can be done with pointer handlers?
https://doc.qt.io/qt-5/qml-qtquick… | |||||
213 | id: mousearea | ||||
214 | anchors.left: parent.left | ||||
215 | width: parent.width | ||||
216 | height: parent.height | ||||
217 | hoverEnabled: true | ||||
218 | acceptedButtons: Qt.LeftButton | ||||
219 | property int pressX: -1 | ||||
220 | property int pressY: -1 | ||||
221 | property bool tapAndHold: false | ||||
222 | | ||||
223 | onPositionChanged: { | ||||
224 | if (mouse.source == Qt.MouseEventSynthesizedByQt) { | ||||
225 | if (pressX != -1 && root.isDrag(pressX, pressY, mouse.x, mouse.y) && tapAndHold) { | ||||
226 | var startpos = mapToItem (popupDialog, pressX, pressY); | ||||
227 | mouseListener.press(startpos.x, startpos.y, mouse.buttons, mouse.modifiers); | ||||
228 | tapAndHold = false; | ||||
229 | } | ||||
230 | } | ||||
231 | | ||||
232 | } | ||||
233 | | ||||
234 | onPressAndHold: { | ||||
235 | if (touchTap) { | ||||
236 | tapAndHold = true; | ||||
237 | parent.onContainsMouseChanged(); | ||||
238 | } | ||||
239 | } | ||||
240 | | ||||
241 | onPressed: { | ||||
242 | if (mouse.source == Qt.MouseEventSynthesizedByQt) { | ||||
243 | mouseListener.pressCanceled(); | ||||
244 | tapAndHold = false; | ||||
245 | touchTap = true; | ||||
246 | pressX = mouse.x; | ||||
247 | pressY = mouse.y; | ||||
248 | } else { | ||||
249 | touchTap = false; | ||||
250 | } | ||||
251 | } | ||||
252 | | ||||
253 | onReleased: { | ||||
254 | if (mouse.source == Qt.MouseEventSynthesizedByQt) { | ||||
255 | if (tapAndHold) { | ||||
256 | var pos = mapToItem (popupDialog, mouse.x, mouse.y); | ||||
257 | mouseListener.press(pos.x, pos.y, Qt.RightButton, mouse.modifiers); | ||||
258 | tapAndHold = false; | ||||
259 | } else { | ||||
260 | parent.onContainsMouseChanged(); | ||||
261 | var pos = mapToItem (popupDialog, mouse.x, mouse.y); | ||||
262 | mouseListener.press(pos.x, pos.y, mouse.buttons, mouse.modifiers); | ||||
263 | mouseListener.click(pos.x, pos.y, Qt.LeftButton); | ||||
264 | } | ||||
265 | } | ||||
266 | touchTap = false; | ||||
267 | tapAndHold = false; | ||||
268 | pressX = -1; | ||||
269 | pressY = -1; | ||||
270 | } | ||||
271 | } | ||||
210 | } | 272 | } | ||
211 | 273 | | |||
212 | Loader { | 274 | Loader { | ||
213 | id: frameLoader | 275 | id: frameLoader | ||
214 | 276 | | |||
215 | x: root.useListViewMode ? 0 : units.smallSpacing | 277 | x: root.useListViewMode ? 0 : units.smallSpacing | ||
216 | y: root.useListViewMode ? 0 : units.smallSpacing | 278 | y: root.useListViewMode ? 0 : units.smallSpacing | ||
217 | 279 | | |||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Line(s) | 449 | PlasmaCore.FrameSvgItem { | |||
393 | opacity: Window.active ? 1 : 0.4 | 455 | opacity: Window.active ? 1 : 0.4 | ||
394 | } | 456 | } | ||
395 | } | 457 | } | ||
396 | 458 | | |||
397 | Component { | 459 | Component { | ||
398 | id: selectionButtonComponent | 460 | id: selectionButtonComponent | ||
399 | 461 | | |||
400 | FolderItemActionButton { | 462 | FolderItemActionButton { | ||
463 | visible: !touchTap | ||||
464 | | ||||
401 | element: model.selected ? "remove" : "add" | 465 | element: model.selected ? "remove" : "add" | ||
402 | 466 | | |||
403 | onClicked: dir.toggleSelected(positioner.map(index)) | 467 | onClicked: dir.toggleSelected(positioner.map(index)) | ||
404 | } | 468 | } | ||
405 | } | 469 | } | ||
406 | 470 | | |||
407 | Component { | 471 | Component { | ||
408 | id: popupButtonComponent | 472 | id: popupButtonComponent | ||
409 | 473 | | |||
410 | FolderItemActionButton { | 474 | FolderItemActionButton { | ||
411 | visible: main.GridView.view.isRootView && (popupDialog == null) | 475 | visible: main.GridView.view.isRootView && (popupDialog == null) && !touchTap | ||
412 | 476 | | |||
413 | element: "open" | 477 | element: "open" | ||
414 | 478 | | |||
415 | onClicked: { | 479 | onClicked: { | ||
416 | dir.setSelected(positioner.map(index)) | 480 | dir.setSelected(positioner.map(index)) | ||
417 | openPopup(); | 481 | openPopup(); | ||
418 | } | 482 | } | ||
419 | } | 483 | } | ||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |
How much of this can be done with pointer handlers?
https://doc.qt.io/qt-5/qml-qtquick-taphandler.html
quickly looking at this mousearea it seems that a taphandler coould be enough.
Would be good if somehow an extra mousearea can be avoided