Skip to content

Improve ChecklistParameter.setValue logic.#2544

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
ntjess:param-fixes
Dec 4, 2022
Merged

Improve ChecklistParameter.setValue logic.#2544
j9ac9k merged 1 commit intopyqtgraph:masterfrom
ntjess:param-fixes

Conversation

@ntjess
Copy link
Copy Markdown
Contributor

@ntjess ntjess commented Dec 2, 2022

Previously, calling setValue would properly fill in child checklist widgets, but wouldn't populate self.opts["value"] with the correct option. This was because setting blockSigal=self._onChildChanging meant childrenValues() wasn't notified that child values were updated. Simply creating and passing a valueToSet object prevents these issues.

I found this bug by calling restoreState, which updates a checklist's value without bubbling up from its widget children.

As a bonus, I (at least tried to) improve the readability of setValue logic.

Previously, calling `setValue` would properly fill in child checklist widgets, but wouldn't populate `self.opts["value"]` with the correct option. This was because setting `blockSigal=self._onChildChanging` meant `childrenValues()` wasn't notified that child values were updated. Simply creating and passing a `valueToSet` object prevents these issues.
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Dec 4, 2022

Thanks for the PR @ntjess this LGTM, merging!

@j9ac9k j9ac9k merged commit 836dabc into pyqtgraph:master Dec 4, 2022
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