From 2157dc8a353f8004313c6301eb429b7dade19077 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 16 Feb 2025 16:33:19 +0100 Subject: [PATCH] Block dropping items on invisible root --- novelwriter/core/itemmodel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/novelwriter/core/itemmodel.py b/novelwriter/core/itemmodel.py index 9cd82c39..7fc79cb9 100644 --- a/novelwriter/core/itemmodel.py +++ b/novelwriter/core/itemmodel.py @@ -379,7 +379,9 @@ class ProjectModel(QAbstractItemModel): row: int, column: int, parent: QModelIndex ) -> bool: """Check if mime data can be dropped on the current location.""" - return data.hasFormat(nwConst.MIME_HANDLE) and action == Qt.DropAction.MoveAction + if parent.isValid() and parent.internalPointer() is not self._root: + return data.hasFormat(nwConst.MIME_HANDLE) and action == Qt.DropAction.MoveAction + return False def dropMimeData( self, data: QMimeData, action: Qt.DropAction,