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 | anchors.left: parent.left | ||||
214 | width: parent.width | ||||
215 | height: parent.height | ||||
216 | hoverEnabled: true | ||||
217 | acceptedButtons: Qt.LeftButton | ||||
218 | | ||||
219 | onPressAndHold: { | ||||
220 | if (touchTap) { | ||||
221 | var pos = mapToGlobal(mouse.x, mouse.y); | ||||
222 | eventGenerator.sendMouseEvent(listener, EventGenerator.MouseButtonPress, pos.x, pos.y, Qt.RightButton, Qt.RightButton, mouse.modifiers); | ||||
223 | } | ||||
224 | } | ||||
225 | | ||||
226 | onPressed: { | ||||
227 | if (mouse.source == Qt.MouseEventSynthesizedByQt) { | ||||
228 | touchTap = true; | ||||
229 | parent.onContainsMouseChanged(); | ||||
230 | var pos = mapToGlobal(mouse.x, mouse.y); | ||||
231 | eventGenerator.sendMouseEvent(listener, EventGenerator.MouseButtonPress, pos.x, pos.y, mouse.button, mouse.buttons, mouse.modifiers); | ||||
232 | } else { | ||||
233 | touchTap = false; | ||||
234 | } | ||||
235 | } | ||||
236 | | ||||
237 | onReleased: { | ||||
238 | if (main.GridView.view.hoveredItem && mouse.source == Qt.MouseEventSynthesizedByQt) { | ||||
239 | var pos = mapToGlobal(mouse.x, mouse.y); | ||||
240 | eventGenerator.sendMouseEvent(listener, EventGenerator.MouseButtonPress, pos.x, pos.y, Qt.LeftButton, Qt.LeftButton, mouse.modifiers); | ||||
241 | eventGenerator.sendMouseEvent(listener, EventGenerator.MouseButtonRelease, pos.x, pos.y, mouse.button, mouse.buttons, mouse.modifiers); | ||||
242 | } | ||||
243 | } | ||||
244 | } | ||||
210 | } | 245 | } | ||
211 | 246 | | |||
212 | Loader { | 247 | Loader { | ||
213 | id: frameLoader | 248 | id: frameLoader | ||
214 | 249 | | |||
215 | x: root.useListViewMode ? 0 : units.smallSpacing | 250 | x: root.useListViewMode ? 0 : units.smallSpacing | ||
216 | y: root.useListViewMode ? 0 : units.smallSpacing | 251 | y: root.useListViewMode ? 0 : units.smallSpacing | ||
217 | 252 | | |||
▲ Show 20 Lines • Show All 323 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