Fix 'GridItem.generatePicture' for cases of invalid size#3284
Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom Mar 24, 2025
Merged
Fix 'GridItem.generatePicture' for cases of invalid size#3284j9ac9k merged 1 commit intopyqtgraph:masterfrom
j9ac9k merged 1 commit intopyqtgraph:masterfrom
Conversation
Member
|
Hey @bbc131 Thanks for the PR; I have no issue with the diff; but I'm side-eyeing returning |
Contributor
Author
|
I'm not sure which approach would be better... Always returning a |
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.
This commit fixes errors in
GridItemthat can occur when the widget is not visible or has an invalid size.I encountered a
RuntimeWarning: divide by zero encountered in log10in
GridItem.generatePixmapat this line:However, I cannot reproduce this issue. But if the bounding rect is null (
boundingRect()returnsQtCore.QRectF()),distbecomes zero, triggering the warning.While trying to reproduce this issue, I encountered another error:
AttributeError: 'NoneType' object has no attribute 'determinant'.This can be reproduced by adding:
to
examples/InfiniteLabel.pyat line 20. Running the example and resizing the window to its minimal possible size will trigger the error.Both issues occur when the widget is not in a state where it can be safely painted.
This fix prevents drawing in such cases.