Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix secondary issues due to Qt tree widget bug #2109

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

vkbo
Copy link
Owner

@vkbo vkbo commented Nov 16, 2024

Summary:

This PR solves two issues in the fallback code that double-checks against a sporadic Qt bug.

In novelWriter, drag and drop is disabled on the project tree root item. However, in several version of Qt 5.15 9at least) this flag is ignored. There is therefore code in place to check that these drops are blocked even when the flag is ignored. (The flag is still useful because it provides visual clues to the drag and drop when it does work.)

Fixes:

  • If a non-root project item somehow ends up on the project tree root, it could not be deleted because the delete item function assumed that all project items without a parent also had a parent widget in the tree, in which case the parent() call would return None. This fix uses the invisible root item instead now, if this occurs, allowing misplaced items to still be deleted.
  • Adds a blocker in the dropEvent handler for events where an item is dropped on the viewport. There are no scenarios in the project tree where this is allowed. The other three values in the enum are allowed in general, and onItem only on other root items.

Related Issue(s):

Closes #2108
Related #1561
Related #1569

Reviewer's Checklist:

  • The header of all files contain a reference to the repository license
  • The overall test coverage is increased or remains the same as before
  • All tests are passing
  • All flake8 checks are passing and the style guide is followed
  • Documentation (as docstrings) is complete and understandable
  • Only files that have been actively changed are committed

@vkbo vkbo added this to the Release 2.5.3 milestone Nov 16, 2024
@vkbo vkbo linked an issue Nov 16, 2024 that may be closed by this pull request
@vkbo vkbo merged commit d944a70 into release Nov 16, 2024
9 checks passed
@vkbo vkbo deleted the fix_nonroot_on_root_delete branch November 16, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Folder Location Error
1 participant