Closed JueAnnLee closed 3 hours ago
Thanks for the error report.
It shouldn't be possible to drag anything onto root level, but there is a bug in some version of Qt that ignores that instruction. I've added additional code to catch it in case it does ignore it. Clearly I haven't plugged all holes. I will look into it, and also plug up the spot where it crashed when you tried to delete.
Normally, it will fix itself with a restart, like you did, since the project structure is checked for invalid entries on open.
By the way, could you tell me how novelWriter was installed? Are you using the Ubuntu package or the AppImage?
I could reproduce your error by disabling the flag that disallows the drag and drop onto the root level. You are clearly running on one of the bugged Qt5 versions where this flag is ignored.
The fallback code blocks most moves, but if you drag an item onto the expand arrow of another item, it accepts the drop. I'll see if I can plug this hole.
This is an error that seems to be re-introduced in Qt 5.15 multiple times. It is also buggy between. 5.15.3 and 5.15.8 somewhere. Hopefully when novelWriter moves to Qt6, this will be resolved. There are multiple bugs in the tree widget related to drag and drop, and they all seem to come and go in random versions.
I was adding a bunch of folders to a project, in the early stages of moving my data into nW. I was dragging folders around the tree and somehow one of those folders ended up in the root folder level of the tree, below the Trash folder. No idea how I did that; I just noticed it was in the wrong place when I was about to add a note to it.
I was able to use ctrl+up to move it near where it belonged, but it remained at root level. So, I made a new folder in the proper place, dragged the contents to that, then attempted to delete the bad folder.
I got a "Divide by Cucumber error". When I closed the error, NovelWriter crashed. When I re-opened it, my data was fine. The bad folder was now at a correct position in the tree, and I was able to delete it normally.
Contents of the error window:
Environment: novelWriter Version: 2.5.2 Host OS: linux (6.8.0-48-generic) Python: 3.12.3 (0x30c03f0) Qt: 5.15.13, PyQt: 5.15.10 enchant: 3.2.2
AttributeError: 'NoneType' object has no attribute 'indexOfChild'
Traceback: File "/usr/lib/python3/dist-packages/novelwriter/gui/projtree.py", line 1945, in
action.triggered.connect(lambda: tree.permDeleteItem(tHandle))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/novelwriter/gui/projtree.py", line 1004, in permDeleteItem tIndex = trItemP.indexOfChild(trItemS) ^^^^^^^^^^^^^^^^^^^^