Warning, /frameworks/kirigami/examples/listitemdraghandle.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.15 0002 import QtQuick.Layouts 1.15 0003 import QtQuick.Controls 2.15 as QQC2 0004 import org.kde.kirigami 2.20 as Kirigami 0005 0006 Kirigami.ApplicationWindow { 0007 pageStack.initialPage: Kirigami.ScrollablePage { 0008 ListView { 0009 id: mainList 0010 model: ListModel { 0011 ListElement { 0012 someText: "Item 1" 0013 } 0014 ListElement { 0015 someText: "Item 2" 0016 } 0017 ListElement { 0018 someText: "Item 3" 0019 } 0020 } 0021 0022 delegate: Item { 0023 width: mainList.width 0024 height: listItemComponent.implicitHeight 0025 Kirigami.AbstractListItem { 0026 id: listItemComponent 0027 contentItem: RowLayout { 0028 Kirigami.ListItemDragHandle { 0029 listItem: listItemComponent 0030 listView: mainList 0031 onMoveRequested: mainList.model.move(oldIndex, newIndex, 1) 0032 } 0033 QQC2.Label { 0034 text: model.someText + " at index " + index 0035 Layout.fillWidth: true 0036 } 0037 } 0038 } 0039 } 0040 0041 moveDisplaced: Transition { 0042 YAnimator { 0043 duration: Kirigami.Units.longDuration 0044 easing.type: Easing.InOutQuad 0045 } 0046 } 0047 } 0048 } 0049 }