getting a little cleaner

This commit is contained in:
Chris Cochrun 2022-08-25 06:17:03 -05:00
parent 19c7e4cd40
commit 2583accef1
2 changed files with 11 additions and 11 deletions

View file

@ -110,11 +110,9 @@ ColumnLayout {
dragItemText,
dragItemIndex);
} else if (drag.keys[0] === "serviceitem") {
moveRequested(dragItemIndex, index);
if (hlIndex === serviceItemList.indexDragged)
serviceItemList.currentIndex = index;
else if (hlIndex === index)
serviceItemList.currentIndex = index + 1;
serviceItemModel.move(serviceItemList.indexDragged,
serviceItemList.moveToIndex);
serviceItemList.currentIndex = moveToIndex;
}
indexedHLRec.visible = false;
}
@ -233,10 +231,6 @@ ColumnLayout {
onTriggered: removeItem(index);
}
}
function dropPlacement(drag) {
print(drag.y);
}
}
}
@ -264,7 +258,13 @@ ColumnLayout {
}
function moveRequested(oldIndex, newIndex) {
serviceItemModel.move(oldIndex, newIndex);
if (newIndex === oldIndex)
return;
if (newIndex === -1)
newIndex = 0;
print("moveRequested: ", oldIndex, newIndex);
visualModel.items.move(oldIndex, newIndex);
indexDragged = newIndex;
}
}

View file

@ -191,7 +191,7 @@ bool ServiceItemModel::move(int sourceIndex, int destIndex) {
sourceIndex, QModelIndex(), destIndex);
if (begsuc) {
if (destIndex = -1)
m_item.move(sourceIndex, 0);
m_items.move(sourceIndex, 0);
else
m_items.move(sourceIndex, destIndex);
endMoveRows();