Skip to content

Invalidate cached properties on geometryChanged signal#2357

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
j9ac9k:fix-axis-resize
Jul 12, 2022
Merged

Invalidate cached properties on geometryChanged signal#2357
j9ac9k merged 1 commit intopyqtgraph:masterfrom
j9ac9k:fix-axis-resize

Conversation

@j9ac9k
Copy link
Copy Markdown
Member

@j9ac9k j9ac9k commented Jul 10, 2022

Fixes #2345

Since #2198 GraphicsWidget attempts to cache properties such as boundingRect; unfortunately it does not appear those caches were being appropriately reset. Luckily the fix was straightforward as QGraphicsWidget has a geometryChanged signal that I used to trigger a cache invalidation.

Took the opportunity to clean up some formatting issues with the file so pycharm can stop having a cow.

@j9ac9k
Copy link
Copy Markdown
Member Author

j9ac9k commented Jul 10, 2022

@danielhrisca if you have some time and want to verify this does not penalize the performance improvement you introduced in #2198 that would be appreciated.

@Seaspider1 if you are able to test to verify this PR fixes your issue, that would be greatly appreciated.

Comment on lines +30 to +38
# def itemChange(self, change, value):
# # BEWARE: Calling QGraphicsWidget.itemChange can lead to crashing!
# # ret = QtWidgets.QGraphicsWidget.itemChange(self, change, value) # segv occurs here
# # The default behavior is just to return the value argument, so we'll do that
# # without calling the original method.
# ret = value
# if change in [self.ItemParentHasChanged, self.ItemSceneHasChanged]:
# self._updateView()
# return ret

Check notice

Code scanning / CodeQL

Commented-out code

These comments appear to contain commented-out code.
@j9ac9k j9ac9k merged commit 59e7b51 into pyqtgraph:master Jul 12, 2022
@j9ac9k j9ac9k deleted the fix-axis-resize branch July 12, 2022 03:19
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.

Axes zoom area does not resize in 0.12.4

1 participant