-
Notifications
You must be signed in to change notification settings - Fork 11
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
Avoid rebuilding models for ListQuantityGroup and ListTextGroup #1903
Merged
blammit
merged 2 commits into
main
from
blam/1338-avoid-rebuilding-models-for-listquantitygroup-and-listtextgroup
Feb 20, 2025
Merged
Avoid rebuilding models for ListQuantityGroup and ListTextGroup #1903
blammit
merged 2 commits into
main
from
blam/1338-avoid-rebuilding-models-for-listquantitygroup-and-listtextgroup
Feb 20, 2025
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
0f77dbd
to
fd51a61
Compare
fd51a61
to
777b93f
Compare
chriadam
reviewed
Feb 17, 2025
CMakeLists.txt
Outdated
@@ -703,6 +702,11 @@ list(APPEND VenusQMLModule_CPP_SOURCES | |||
src/productinfo.h | |||
src/quantityinfo.h | |||
src/quantityinfo.cpp | |||
src/quantityinfo.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated file reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
777b93f
to
f2e839a
Compare
chriadam
approved these changes
Feb 20, 2025
QuantityObject provides QObject-based access to a quantity value. QuantityObjectModel provides a model of QuantityObject values, and is able to filter out items that do not have valid values. This allows ListQuantityGroup and its derived types to specify their models without creating a JavaScript array that directly refers each quantity value. Otherwise, whenever a quantity value is updated, the entire array is rebuilt, which in turn causes the QuantityRow repeater to rebuild its delegates. Part of #1338
Change QuantityRow's model type to QuantityObjectModel, so that the model cannot be specified as an array of real values, and update the codebase accordingly so that it always uses QuantityObject with QuantityObjectModel instead of an array-based model in all cases where multiple quantities are displayed. This greatly improves the performance of QuantityRow in updating its values, as the Repeater no longer rebuilds its delegates whenever a single quantity changes in the model. Also, since QuantityObjectModel is able to filter out invalid values, it is not necessary to create and show separate models depending on whether particular values are valid. The updates affect the following types and their uses: - QuantityRow - ListQuantityGroup - ListQuantityGroupNavigation Also remove ListTextGroup and replace its uses with ListQuantityGroup, as ListTextGroup was being used to show text alongside number values, and that can now easily be done with ListQuantityGroup as a QuantityObject value can be a string if the unit is Units_None. Part of #1338
f2e839a
to
faaf021
Compare
Rebased. |
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.
No description provided.