Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/FolderItemDelegate.qml
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Line(s) | 84 | Item { | |||
---|---|---|---|---|---|
95 | property Item label: label | 95 | property Item label: label | ||
96 | property Item labelArea: frameLoader.textShadow || label | 96 | property Item labelArea: frameLoader.textShadow || label | ||
97 | property Item actionsOverlay: actions | 97 | property Item actionsOverlay: actions | ||
98 | property Item hoverArea: toolTip | 98 | property Item hoverArea: toolTip | ||
99 | property Item frame: frameLoader | 99 | property Item frame: frameLoader | ||
100 | property Item toolTip: toolTip | 100 | property Item toolTip: toolTip | ||
101 | property Item selectionButton: null | 101 | property Item selectionButton: null | ||
102 | property Item popupButton: null | 102 | property Item popupButton: null | ||
103 | property bool touchTap: false | ||||
103 | 104 | | |||
104 | onSelectedChanged: { | 105 | onSelectedChanged: { | ||
105 | if (selected && !blank) { | 106 | if (selected && !blank) { | ||
106 | frameLoader.grabToImage(function(result) { | 107 | frameLoader.grabToImage(function(result) { | ||
107 | dir.addItemDragImage(positioner.map(index), main.x + frameLoader.x, main.y + frameLoader.y, frameLoader.width, frameLoader.height, result.image); | 108 | dir.addItemDragImage(positioner.map(index), main.x + frameLoader.x, main.y + frameLoader.y, frameLoader.width, frameLoader.height, result.image); | ||
108 | }); | 109 | }); | ||
109 | } | 110 | } | ||
110 | } | 111 | } | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
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; | ||
170 | } | 171 | } | ||
171 | } | 172 | } | ||
172 | 173 | touchTap = false; | |||
173 | main.GridView.view.hoveredItem = main; | 174 | main.GridView.view.hoveredItem = main; | ||
174 | } | 175 | } | ||
175 | } | 176 | } | ||
176 | 177 | | |||
177 | states: [ | 178 | states: [ | ||
178 | State { // icon view | 179 | State { // icon view | ||
179 | when: !root.useListViewMode | 180 | when: !root.useListViewMode | ||
180 | 181 | | |||
Show All 21 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 | property bool isTouch: false | ||||
214 | anchors.left: parent.left | ||||
215 | width: parent.width | ||||
216 | height: parent.height | ||||
217 | hoverEnabled: true | ||||
218 | acceptedButtons: Qt.LeftButton | Qt.RightButton | ||||
219 | | ||||
220 | onPressAndHold: { | ||||
221 | if (isTouch) { | ||||
222 | var pos = mapToGlobal(mouse.x, mouse.y); | ||||
223 | eventGenerator.sendMouseEvent(listener, EventGenerator.MouseButtonPress, pos.x, pos.y, Qt.RightButton, Qt.RightButton, mouse.modifiers); | ||||
224 | } | ||||
225 | } | ||||
226 | | ||||
227 | onPressed: { | ||||
228 | if (mouse.source == Qt.MouseEventSynthesizedByQt) { | ||||
229 | isTouch = true; | ||||
230 | touchTap = true; | ||||
231 | parent.onContainsMouseChanged(); | ||||
232 | var pos = mapToGlobal(mouse.x, mouse.y); | ||||
233 | eventGenerator.sendMouseEvent(listener, EventGenerator.MouseButtonPress, pos.x, pos.y, mouse.button, mouse.buttons, mouse.modifiers); | ||||
234 | if (!Qt.styleHints.singleClickActivation) { | ||||
235 | eventGenerator.sendMouseEvent(listener, EventGenerator.MouseButtonPress, pos.x, pos.y, mouse.button, mouse.buttons, mouse.modifiers); | ||||
236 | } | ||||
237 | } else { | ||||
238 | isTouch = false; | ||||
239 | } | ||||
240 | } | ||||
241 | } | ||||
242 | | ||||
210 | } | 243 | } | ||
211 | 244 | | |||
212 | Loader { | 245 | Loader { | ||
213 | id: frameLoader | 246 | id: frameLoader | ||
214 | 247 | | |||
215 | x: root.useListViewMode ? 0 : units.smallSpacing | 248 | x: root.useListViewMode ? 0 : units.smallSpacing | ||
216 | y: root.useListViewMode ? 0 : units.smallSpacing | 249 | y: root.useListViewMode ? 0 : units.smallSpacing | ||
217 | 250 | | |||
▲ Show 20 Lines • Show All 316 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