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 lost index on selection change in Attribute Table #52045

Merged
merged 3 commits into from
Mar 3, 2023

Conversation

signedav
Copy link
Contributor

Issue was that the index always jumps to the first position when I make a feature selection (yellow):

IndexLostOnSelection.webm

The original implementation intended that the index jumps to the first feature in the made selection (in case the indexed feature is currently not in the selection - otherwise the index should presist). But this did not work: Problem was that when the connection to the lambda updating the index has the parameter of it's initialization. Means inSelection was always false and with this the index received 0 (first position).

This fix decapsulates the update function from where the timer to trigger starts. Since we cannot pass the parameter inSelection because of the timer I created two timer (and with it two connections).

I decided against a quick fix with deconnect/connect the lambda function on every ensureEditSelection because of the fragility of those triggers in the attribute table. The proposed sollution is in my opinion more secure.

Fixed sollution looks like this:

selectiontakesindex.webm

This because before it did not change the inSelection after the first instance of the connection.
…e - times out 1 millisecond or receives currentEditSelectionChanged
Copy link
Member

@m-kuhn m-kuhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@signedav signedav merged commit 08c7d66 into qgis:master Mar 3, 2023
@signedav signedav deleted the yellow_index_lost branch March 3, 2023 12:18
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.

2 participants