GraphicsLayout: Always call layout.activate() after adding items#1173
Merged
j9ac9k merged 1 commit intopyqtgraph:developfrom May 30, 2020
Merged
GraphicsLayout: Always call layout.activate() after adding items#1173j9ac9k merged 1 commit intopyqtgraph:developfrom
j9ac9k merged 1 commit intopyqtgraph:developfrom
Conversation
Items added to a `GraphicsLayout` only learn their size information after the internal `QGraphicsGridLayout` recalculates the layout. This is happening as a slot in the Qt event queue. Not having updated geometry bounds directly after adding an item leads to multiple issues when not executing the Qt event loop in time (see below). This commit fixes that by always calling `layout.activate()` after adding items, updating item sizes directly. This is a follow-up to PR pyqtgraph#1167, where introducing a direct call to `processEvents` was suspected to be able to cause side effects. Notifying @j9ac9k and @campagnola, as they were involved in pyqtgraph#1167. Fixes pyqtgraph#8 Fixes pyqtgraph#1136
Member
|
Closing/Re-Opening to trigger new CI runs now that we're skipping |
Member
|
Thanks for the PR @2xB this looks good to me, and the CI system agrees! |
3 tasks
This file contains hidden or 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
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.
When items are added to a
GraphicsLayoutitems in the layout only learn their updated size information after the internalQGraphicsGridLayoutrecalculates the layout.This is happening as a slot in the Qt event queue.
Not having updated geometry bounds directly after adding an item leads to multiple issues when not executing the Qt event loop in time (see below). This commit fixes that by always calling
layout.activate()after adding items, updating item sizes directly.This is a follow-up to PR #1167, where introducing a direct call to
processEventswas suspected to be able to cause side effects.Notifying @j9ac9k and @campagnola, as they were involved in #1167.
Testing code used next to MWE from issues below:
Fixes #8
Fixes #1136