-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Rewrite project tree as a model/view set #2119
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This PR is a major refactoring of how the project structure is handled in novelWriter. The reason for this rewrite is that there are continuous problems with the current implementation where the core project keeps a set if all project items in a flat list, while the GUI component displaying the project tree is the only part with an up-to-date record of the order and hierarchy of the project items. In order to keep them consistent, the information must constantly be synched between the two representations of the project. This has worked reasonably well so far, but requires a lot of code, and it is very easy to introduce bugs into this.
In the model/view design, the project tree model is the only unit knowing the full structure of the tree. The model is a subclass of QAbstractItemModel, so it can be loaded directly into the QTreeView displaying it. Any change done in the GUI tree widget is done directly on the model. The core project tree class owns the model, and provides access methods and maintenance methods for other parts of the code that needs to change the model, and it emits signals on behalf of the model when the model is changed by the user on the GUI.
Having one central and complete model of the project structure also allows for some new features:
Due to the scope of this change, a 2.6 Beta 2 release is needed before moving on to a release candidate. A lot of features had to be re-implemented in the new model, and there may be bugs in it, or details missing.
Related Issue(s):
Reviewer's Checklist: