add loadingItem to serviceList

The loading item will show as things are dropped into the
listview. This makes sure the user sees a loading bit as things are
happening in the background to add the new serviceItem
This commit is contained in:
Chris Cochrun 2023-03-07 12:53:27 -06:00
parent d349e0a572
commit a946db072d

View file

@ -60,10 +60,11 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
onDropped: (drag) => { onDropped: (drag) => {
console.log("DROPPED AT END"); console.log("DROPPED AT END");
showPassiveNotification(drag.source.title); loadingItem.visible = true;
appendItem(dragItemType, appendItem(dragItemType,
dragItemIndex); dragItemIndex);
dropHighlightLine.visible = false; dropHighlightLine.visible = false;
loadingItem.visible = false;
} }
keys: ["library"] keys: ["library"]
@ -92,14 +93,13 @@ Item {
onEntered: (drag) => { onEntered: (drag) => {
if (drag.keys[0] === "library") { if (drag.keys[0] === "library") {
dropHighlightLine.visible = true; dropHighlightLine.visible = true;
showPassiveNotification("Y is: " + serviceDrop.mapToItem(
serviceItemList,0,0).y);
dropHighlightLine.y = serviceDrop.mapToItem( dropHighlightLine.y = serviceDrop.mapToItem(
serviceItemList,0,0).y - 2; serviceItemList,0,0).y - 2;
} }
} }
onDropped: (drag) => { onDropped: (drag) => {
loadingItem.visible = true;
console.log("DROPPED IN ITEM AREA: " + drag.keys); console.log("DROPPED IN ITEM AREA: " + drag.keys);
console.log(dragItemIndex + " " + index); console.log(dragItemIndex + " " + index);
const hlIndex = serviceItemList.currentIndex; const hlIndex = serviceItemList.currentIndex;
@ -113,6 +113,7 @@ Item {
/* serviceItemList.currentIndex = moveToIndex; */ /* serviceItemList.currentIndex = moveToIndex; */
} }
dropHighlightLine.visible = false; dropHighlightLine.visible = false;
loadingItem.visible = false;
} }
keys: ["library","serviceitem"] keys: ["library","serviceitem"]
@ -431,6 +432,18 @@ Item {
/* PathLine { x: -40; y: 200 } */ /* PathLine { x: -40; y: 200 } */
/* } */ /* } */
/* } */ /* } */
Rectangle {
id: loadingItem
anchors.fill: parent
color: Kirigami.Theme.backgroundColor
visible: false
Controls.BusyIndicator {
anchors.centerIn: parent
running: true
}
}
} }
Kirigami.ActionToolBar { Kirigami.ActionToolBar {
@ -501,6 +514,13 @@ Item {
showPassiveNotification("clearing all items"); showPassiveNotification("clearing all items");
ServiceItemModel.clearAll(); ServiceItemModel.clearAll();
} }
},
Kirigami.Action {
text: "Load"
icon.name: "list-remove-all"
onTriggered: {
loadingItem.visible = !loadingItem.visible;
}
} }
] ]
} }