-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QSortFilterProxyModel: add a protected beginFilterChange
If the filter gets changed and invalidated while there is no mapping (perhaps because the model had been invalidated first), then we fail to notice the change and don't emit rowsInserted/Removed. And as the new filter is already in place by the time invalidateFilter gets called, we cannot know what the size of the model was before the change. The only way to fix that is to introduce a beginFilterChange protected function that makes sure that we have a mapping from the source model with the old filter. That is a no-op if a mapping is already in place, costing only the lookup in a hash table. By calling this function, custom models with their own filtering logic can make sure that their model emits the changed-signals as expected. Add test coverage and documentation and fix the relevant examples snippet to use that new protected function as recommended, and to invalidate only the rows filter. [ChangeLog][Core][QSortFilterProxyModel] Added a new protected function beginFilterChange() that subclasses overriding filterAcceptsRow or filterAcceptsColumn should call before the filter parameter is changed. This makes sure that the signals informing about rows or columns changing get correctly emitted. Fixes: QTBUG-115717 Change-Id: Ib73a7119ac9dd9c4bcf220f1274d6b4ed093e7ff Reviewed-by: David Faure <[email protected]>
- Loading branch information
Showing
5 changed files
with
97 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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
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