Tree items can be moved up and down from the context menu

This commit is contained in:
Veronica K. B. Olsen
2019-04-23 22:41:41 +02:00
parent 30c1241488
commit 184c33a59e
4 changed files with 16 additions and 5 deletions
+11
View File
@@ -76,6 +76,17 @@ class GuiDocTree(QTreeWidget):
return
def moveTreeItem(self, tHandle, nStep):
tItem = self.theMap[tHandle]
pItem = tItem.parent()
tIndex = pItem.indexOfChild(tItem)
nChild = pItem.childCount()
nIndex = tIndex + nStep
if nIndex < 0 or nIndex >= nChild: return
cItem = pItem.takeChild(tIndex)
pItem.insertChild(nIndex, cItem)
return
def saveTreeOrder(self):
theList = []
for i in range(self.topLevelItemCount()):