Changeset View
Changeset View
Standalone View
Standalone View
src/controls/templates/SwipeListItem.qml
Show First 20 Lines • Show All 249 Lines • ▼ Show 20 Line(s) | 249 | if (listItem.actions.length === 0) { | |||
---|---|---|---|---|---|
250 | return null; | 250 | return null; | ||
251 | } else { | 251 | } else { | ||
252 | return listItem.actions[0].text !== undefined && | 252 | return listItem.actions[0].text !== undefined && | ||
253 | listItem.actions[0].trigger !== undefined ? | 253 | listItem.actions[0].trigger !== undefined ? | ||
254 | listItem.actions : | 254 | listItem.actions : | ||
255 | listItem.actions[0]; | 255 | listItem.actions[0]; | ||
256 | } | 256 | } | ||
257 | } | 257 | } | ||
258 | delegate: Icon { | 258 | delegate: Controls.ToolButton { | ||
259 | height: actionsLayout.height | 259 | anchors.verticalCenter: parent.verticalCenter | ||
260 | width: height | 260 | icon.name: modelData.iconName !== "" ? modelData.iconName : undefined | ||
261 | source: modelData.iconName !== "" ? modelData.iconName : modelData.iconSource | 261 | icon.source: modelData.iconSource !== "" ? modelData.iconSource : undefined | ||
262 | enabled: (modelData && modelData.enabled !== undefined) ? modelData.enabled : true; | 262 | enabled: (modelData && modelData.enabled !== undefined) ? modelData.enabled : true; | ||
263 | visible: (modelData && modelData.visible !== undefined) ? modelData.visible : true; | 263 | visible: (modelData && modelData.visible !== undefined) ? modelData.visible : true; | ||
264 | onVisibleChanged: { | 264 | onVisibleChanged: { | ||
265 | if (visible) { | 265 | if (visible) { | ||
266 | actionsLayout.visibleActions++; | 266 | actionsLayout.visibleActions++; | ||
267 | } else { | 267 | } else { | ||
268 | actionsLayout.visibleActions--; | 268 | actionsLayout.visibleActions--; | ||
269 | } | 269 | } | ||
270 | } | 270 | } | ||
271 | Component.onCompleted: { | 271 | Component.onCompleted: { | ||
272 | if (visible) { | 272 | if (visible) { | ||
273 | actionsLayout.visibleActions++; | 273 | actionsLayout.visibleActions++; | ||
274 | } | 274 | } | ||
275 | } | 275 | } | ||
276 | Component.onDestruction: { | 276 | Component.onDestruction: { | ||
277 | if (visible) { | 277 | if (visible) { | ||
278 | actionsLayout.visibleActions--; | 278 | actionsLayout.visibleActions--; | ||
279 | } | 279 | } | ||
280 | } | 280 | } | ||
281 | MouseArea { | 281 | Controls.ToolTip.delay: 1000 | ||
282 | id: actionMouse | 282 | Controls.ToolTip.timeout: 5000 | ||
apol: Should move these values to Units, can be done in a separate patch. | |||||
ngraham: Sure, will do that after this lands. | |||||
283 | anchors { | 283 | Controls.ToolTip.visible: listItem.visible && (Settings.tabletMode ? pressed : hovered) && Controls.ToolTip.text.length > 0 | ||
284 | fill: parent; | 284 | Controls.ToolTip.text: modelData.tooltip || modelData.text | ||
285 | margins: Settings.tabletMode ? -Units.smallSpacing : 0; | 285 | | ||
286 | } | | |||
287 | enabled: (modelData && modelData.enabled !== undefined) ? modelData.enabled : true; | | |||
288 | hoverEnabled: !Settings.tabletMode | | |||
289 | onClicked: { | 286 | onClicked: { | ||
290 | if (modelData && modelData.trigger !== undefined) { | 287 | if (modelData && modelData.trigger !== undefined) { | ||
291 | modelData.trigger(); | 288 | modelData.trigger(); | ||
This undefined will just warn on tablet mode. I'd remove it, do we need to specify it? A ToolButton should already behave properly. apol: This undefined will just warn on tablet mode. I'd remove it, do we need to specify it? A… | |||||
292 | } | 289 | } | ||
293 | positionAnimation.from = background.x; | 290 | positionAnimation.from = background.x; | ||
294 | positionAnimation.to = 0; | 291 | positionAnimation.to = 0; | ||
295 | positionAnimation.running = true; | 292 | positionAnimation.running = true; | ||
296 | } | 293 | } | ||
297 | Controls.ToolTip.delay: 1000 | | |||
298 | Controls.ToolTip.timeout: 5000 | | |||
299 | Controls.ToolTip.visible: listItem.visible && (Settings.tabletMode ? actionMouse.pressed : actionMouse.containsMouse) && Controls.ToolTip.text.length > 0 | | |||
300 | Controls.ToolTip.text: modelData.tooltip || modelData.text | | |||
301 | } | | |||
302 | } | 294 | } | ||
303 | } | 295 | } | ||
304 | } | 296 | } | ||
305 | } | 297 | } | ||
306 | 298 | | |||
307 | MouseArea { | 299 | MouseArea { | ||
308 | id: handleMouse | 300 | id: handleMouse | ||
309 | parent: listItem.background | 301 | parent: listItem.background | ||
▲ Show 20 Lines • Show All 156 Lines • Show Last 20 Lines |
Should move these values to Units, can be done in a separate patch.