-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Layer dependencies] Emit QgsVectorLayer::dataChanged on commitChanges #58528
base: master
Are you sure you want to change the base?
Conversation
c0c4bf6
to
9bf2d45
Compare
@Djedouas After a second thought on our discussion I'm wondering if we could not fire only one dataChange on commit instead of 2 when adding (delete the -1 feature +add the inserted one) and 0 (3 with your proposal) when commit. Of course, without changing the general behavior when it's not about committing. We could use the |
This is potentially a big speed regression -- eg QgsPointLocator connects to QgsVectorLayer::dataChanged and destroys the index when it's emitted, and the attribute table (via QgsVectorLayerCache) will also trigger a full rebuild. My understanding was that dataChanged should only be used when we don't know what's changed, but when we DO know what's changed the atomic signals (featureAdded, etc) are better because we can handle them in optimised ways. Isn't all this supposed to be handled by the logic in QgsVectorLayer::setDependencies anyway? That's setting up manual connections to emit dataChanged when the atomic signals are received from a dependent layer. |
That's the case here, a dependency has been committed, and so eventually the layer depending on it has also changed (because of trigger for instance) and need to fire dataChanged . This PR doesn't change this.
Yes, that's what it's intended here (don't know why we reloadData() and not just fire dataChanged signal in that case). I don't see any regression here, except IMHO we fire too many dataChanged per event. |
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
I'm confused now -- was a force push used here to change the approach? The current changes don't seem to match with the PR description (or more recollections from previously reviewing this) |
Nothing changed since the PR creation |
Now when a feature is externally modified on save (database trigger for example), the dataChanged signal is emitted for indexes and caches reconstruction.
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
9bf2d45
to
37e70f3
Compare
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
37e70f3
to
6061bcc
Compare
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.
We discussed this with @Djedouas , I think the proposal is good as it implies only one additional signal firing when committing instead of 3 (feature added+deleted+commit) when it comes to new feature.
6061bcc
to
98a6c9a
Compare
Description
Fixes #57784 where even if the layer is checked as a dependency layer, there is no reloading of data when the layer is saved.
With this change, the dataChanged signal is emitted on commitChanges, so that when a feature is externally modified on save (database trigger for example) we have index and cache reconstruction.
Related PRs:
This change is kind of following this particular comment/discussion #41463 (comment)
See the tests explaining the multiple emissions of
dataChanged
.Ping @suricactus @m-kuhn @MorriganR @troopa81 @3nids for review