From a946db072dc64f5dc47fb2992e3defd2ebadae88 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 7 Mar 2023 12:53:27 -0600 Subject: [PATCH] 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 --- src/qml/presenter/ServiceList.qml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/qml/presenter/ServiceList.qml b/src/qml/presenter/ServiceList.qml index 78f1df3..e55d14c 100644 --- a/src/qml/presenter/ServiceList.qml +++ b/src/qml/presenter/ServiceList.qml @@ -60,10 +60,11 @@ Item { Layout.fillWidth: true onDropped: (drag) => { console.log("DROPPED AT END"); - showPassiveNotification(drag.source.title); + loadingItem.visible = true; appendItem(dragItemType, dragItemIndex); dropHighlightLine.visible = false; + loadingItem.visible = false; } keys: ["library"] @@ -92,14 +93,13 @@ Item { onEntered: (drag) => { if (drag.keys[0] === "library") { dropHighlightLine.visible = true; - showPassiveNotification("Y is: " + serviceDrop.mapToItem( - serviceItemList,0,0).y); dropHighlightLine.y = serviceDrop.mapToItem( serviceItemList,0,0).y - 2; } } onDropped: (drag) => { + loadingItem.visible = true; console.log("DROPPED IN ITEM AREA: " + drag.keys); console.log(dragItemIndex + " " + index); const hlIndex = serviceItemList.currentIndex; @@ -113,6 +113,7 @@ Item { /* serviceItemList.currentIndex = moveToIndex; */ } dropHighlightLine.visible = false; + loadingItem.visible = false; } keys: ["library","serviceitem"] @@ -431,6 +432,18 @@ Item { /* 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 { @@ -501,6 +514,13 @@ Item { showPassiveNotification("clearing all items"); ServiceItemModel.clearAll(); } + }, + Kirigami.Action { + text: "Load" + icon.name: "list-remove-all" + onTriggered: { + loadingItem.visible = !loadingItem.visible; + } } ] }