21 import QtQuick.Layouts 1.2
22 import QtQuick.Controls 1.0 as Controls
23 import QtQuick.Controls.Private 1.0
24 import org.kde.kirigami 1.0
67 default property Item contentItem
75 property alias supportsMouseEvents: itemMouse.enabled
102 property bool checked:
false
109 property alias pressed: itemMouse.pressed
116 property alias containsMouse: itemMouse.containsMouse
123 property bool sectionDelegate:
false
130 property bool separatorVisible:
true
138 property list<Action> actions
147 property real position: 0
158 property Item background
167 property color textColor:
Theme.viewTextColor
173 property color backgroundColor:
Theme.viewBackgroundColor
183 property color activeTextColor:
Theme.highlightedTextColor
190 property color activeBackgroundColor:
Theme.highlightColor
201 color:
Theme.backgroundColor
214 x: behindItem.width - (behindItem.width * listItem.position)
217 bottom: parent.bottom
222 implicitWidth: parent ? parent.width : contentItem.width + paddingItem.anchors.margins * 2
227 onBackgroundChanged: {
229 background.parent = itemMouse;
230 background.anchors.fill = itemMouse;
235 onContentItemChanged: {
236 contentItem.parent = paddingItem
240 Component.onCompleted: {
242 contentItemChanged();
246 if (!mainFlickable.loopCheck && !handleMouse.pressed && !mainFlickable.flicking &&
247 !mainFlickable.dragging && !positionAnimation.running) {
248 mainFlickable.contentX = (listItem.width-listItem.height) * mainFlickable.internalPosition;
259 verticalCenter: parent.verticalCenter
263 width: childrenRect.width
264 property bool exclusive:
false
265 property Item checkedButton
269 if (listItem.actions.length == 0) {
272 return listItem.actions[0].text !== undefined &&
273 listItem.actions[0].trigger !== undefined ?
279 height: actionsLayout.height
281 source: modelData.iconName
282 enabled: (modelData && modelData.enabled !== undefined) ? modelData.enabled :
true;
283 visible: (modelData && modelData.visible !== undefined) ? modelData.visible :
true;
289 enabled: (modelData && modelData.enabled !== undefined) ? modelData.enabled :
true;
291 if (modelData && modelData.trigger !== undefined) {
294 }
else if (toolbar.model.length > index) {
295 toolbar.model[index].trigger();
297 console.log(
"Don't know how to trigger the action")
299 positionAnimation.to = 0;
300 positionAnimation.running =
true;
308 id: positionAnimation
309 target: mainFlickable
310 properties:
"contentX"
312 easing.type: Easing.InOutQuad
319 boundsBehavior: Flickable.StopAtBounds
321 contentWidth: mainItem.width
322 contentHeight: height
324 if (contentX > width / 2) {
325 positionAnimation.to = width - height;
327 positionAnimation.to = 0;
329 positionAnimation.running =
true;
331 readonly
property real internalPosition: (mainFlickable.contentX/(listItem.width-listItem.height));
332 property bool loopCheck:
false
333 onInternalPositionChanged: {
336 listItem.position = internalPosition;
343 width: (mainFlickable.width * 2) - handleMouse.width
344 height: mainFlickable.height
350 bottom: parent.bottom
352 hoverEnabled: !Settings.isMobile
353 width: mainFlickable.width
354 onClicked: listItem.clicked()
355 onPressAndHold: listItem.pressAndHold()
370 left: itemMouse.right
371 right: itemMouse.right
373 bottom: parent.bottom
376 preventStealing:
true
377 property var downTimestamp;
379 property int startMouseX
382 if (Math.abs(startX - mainFlickable.contentX) >
Units.
gridUnit ||
386 if (mainFlickable.contentX > mainFlickable.width / 2) {
387 positionAnimation.to = 0;
389 positionAnimation.to = mainFlickable.width - mainFlickable.height;
391 positionAnimation.running =
true;
394 downTimestamp = (
new Date()).getTime();
395 startX = mainFlickable.contentX;
396 startMouseX = mouse.x;
399 mainFlickable.contentX = Math.max(0, Math.min(mainFlickable.width - height, mainFlickable.contentX + (startMouseX - mouse.x)))
402 var speed = ((startX - mainFlickable.contentX) / ((
new Date()).getTime() - downTimestamp) * 1000);
403 mainFlickable.flick(speed, 0);
407 anchors.centerIn: parent
408 selected: listItem.checked || (listItem.pressed && !listItem.checked && !listItem.sectionDelegate)
411 source: (mainFlickable.contentX > mainFlickable.width / 2) ?
"handle-right" :
"handle-left"
418 Accessible.role: Accessible.ListItem
int smallSpacing
units.smallSpacing is the amount of spacing that should be used around smaller UI elements...
int longDuration
units.longDuration should be used for longer, screen-covering animations, for opening and closing of ...
int largeSpacing
units.largeSpacing is the amount of spacing that should be used inside bigger UI elements, for example between an icon and the corresponding text.
int gridUnit
The fundamental unit of space that should be used for sizes, expressed in pixels. ...
QtObject iconSizes
units.iconSizes provides access to platform-dependent icon sizing