diff --git a/novelwriter/gui/projtree.py b/novelwriter/gui/projtree.py index 3da4eb1b..5b39d78d 100644 --- a/novelwriter/gui/projtree.py +++ b/novelwriter/gui/projtree.py @@ -1455,7 +1455,6 @@ class GuiProjectTree(QTreeWidget): wCount = self._getItemWordCount(sHandle) self.propagateCount(sHandle, 0) - event.accept() super().dropEvent(event) self._postItemMove(sHandle, wCount) self._recordLastMove(sItem, pItem, pIndex) diff --git a/tests/test_gui/test_gui_projtree.py b/tests/test_gui/test_gui_projtree.py index 2a7939f1..0f834d65 100644 --- a/tests/test_gui/test_gui_projtree.py +++ b/tests/test_gui/test_gui_projtree.py @@ -988,9 +988,17 @@ def testGuiProjTree_DragAndDrop(qtbot, monkeypatch, caplog, nwGUI: GuiMain, proj mouse = Qt.MouseButton.LeftButton modifier = Qt.KeyboardModifier.NoModifier + # Move an item + # The actual move is blocked, but the undo history should record + # the event, although without an actual move implied + assert projTree._lastMove == {} event = QDropEvent(nPos, action, mime, mouse, modifier) projTree.dropEvent(event) - assert event.isAccepted() is True + assert projTree._lastMove == { + "item": projTree._getTreeItem(C.hSceneDoc), + "parent": projTree._getTreeItem(C.hChapterDir), + "index": 1, + } # Invalid location caplog.clear()