Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo committed Nov 16, 2024
2 parents 49bb7f3 + d944a70 commit 7a9da5f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions novelwriter/gui/projtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,9 @@ def permDeleteItem(self, tHandle: str, askFirst: bool = True, flush: bool = True

self.propagateCount(tHandle, 0)

trItemP = trItemS.parent()
# If a non-root item ends up on root due to a bug, allow it
# to still be deleted from invisible root (see #2108)
trItemP = trItemS.parent() or self.invisibleRootItem()
tIndex = trItemP.indexOfChild(trItemS)
trItemP.takeChild(tIndex)

Expand Down Expand Up @@ -1328,9 +1330,11 @@ def dropEvent(self, event: QDropEvent) -> None:
action is allowed, and update relevant data.
"""
tItem = self.itemAt(event.pos())
dropOn = self.dropIndicatorPosition() == QAbstractItemView.DropIndicatorPosition.OnItem
onItem = self.dropIndicatorPosition() == QAbstractItemView.DropIndicatorPosition.OnItem
onView = self.dropIndicatorPosition() == QAbstractItemView.DropIndicatorPosition.OnViewport
# Make sure nothing can be dropped on invisible root (see #1569)
if not tItem or tItem.parent() is None and not dropOn:
# Make sure nothing can be dropped on the viewport (see #2108)
if tItem is None or (tItem.parent() is None and not onItem) or onView:
logger.error("Invalid drop location")
event.ignore()
return
Expand Down

0 comments on commit 7a9da5f

Please sign in to comment.