Skip to content

inherit GraphicsWidgetAnchor on the left-hand-side#2662

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:inherit-gwa-lhs
Mar 25, 2023
Merged

inherit GraphicsWidgetAnchor on the left-hand-side#2662
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:inherit-gwa-lhs

Conversation

@pijyoi
Copy link
Copy Markdown
Contributor

@pijyoi pijyoi commented Mar 25, 2023

Following the merge of https://code.qt.io/cgit/pyside/pyside-setup.git/commit/?id=e8095467f7d0332cc0987e7c541de9906e19fece slated for PySide6 6.5, inheriting GraphicsWidgetAnchor on the right-hand-side no longer works.

In fact, since PyQt{5,6} do implement cooperative inheritance, then the previous implementation of inheriting GraphicsWidgetAnchor on the right-hand-side would be wrong. i.e. GraphicsWidgetAnchor::__init__ was being called twice on PyQt{5,6}. (Indeed, adding simple print statements shows that it was being called twice on PyQt{5,6}
There is a connect statement in GraphicsWidgetAnchor::__init__, which would make calling it multiple times not harmless.

Note: GraphicsWidgetAnchor as a mixin should be inherited on the left-hand-side.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Mar 25, 2023

glad this didn't have other consequences like with the docks!

Thanks for identifying this issue and submitting a fix @pijyoi merging!

@pijyoi
Copy link
Copy Markdown
Contributor Author

pijyoi commented Apr 14, 2023

Was contemplating whether we should disinherit pg.LabelItem from GraphicsWidgetAnchor, as the library itself doesn't make use of this feature.
However, a search (https://github.com/search?q=pg.labelitem+and+setparentitem+and+anchor&type=Code) turned up several instances of code in the wild making use of this feature:

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