Allow files to have child items

This commit is contained in:
Veronica Berglyd Olsen
2022-04-23 15:53:14 +02:00
parent 64da2793ac
commit 1a47bbaf8c
2 changed files with 36 additions and 41 deletions
+2 -7
View File
@@ -793,17 +793,12 @@ class GuiProjectTree(QTreeWidget):
# - Files can be moved anywhere
# - Folders can only be moved within the same root folder
# - Root folders cannot be moved at all
# - Items cannot be dropped on top of a file (moved inside)
isFile = snItem.itemType == nwItemType.FILE
isRoot = snItem.itemType == nwItemType.ROOT
onFile = dnItem.itemType == nwItemType.FILE
inSame = snItem.itemRoot == dnItem.itemRoot
allowDrop = inSame or isFile
allowDrop &= not (self.dropIndicatorPosition() == QAbstractItemView.OnItem and onFile)
if allowDrop and not isRoot:
if (inSame or isFile) and not isRoot:
logger.debug("Drag'n'drop of item '%s' accepted", sHandle)
wCount = int(sItem.data(self.C_COUNT, Qt.UserRole))
@@ -1057,7 +1052,7 @@ class GuiProjectTreeMenu(QMenu):
trashHandle = self.theTree.theProject.projTree.trashRoot()
inTrash = theItem.itemParent == trashHandle and trashHandle is not None
inTrash = self.theTree.theProject.projTree.isTrash(theItem.itemHandle)
isTrash = theItem.itemHandle == trashHandle and trashHandle is not None
isFile = theItem.itemType == nwItemType.FILE