Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGraphicsItem subclasses init refactoring bug #31

Open
smidm opened this issue Feb 16, 2022 · 0 comments
Open

QGraphicsItem subclasses init refactoring bug #31

smidm opened this issue Feb 16, 2022 · 0 comments

Comments

@smidm
Copy link
Contributor

smidm commented Feb 16, 2022

It seems that all initializations of QGraphicsItem subclasses are refactored in this way:

class MyEllipse(QtGui.QGraphicsEllipseItem):
+class MyEllipse(QtWidgets.QGraphicsEllipseItem):
     def __init__(self, radius=5.0):
-        super(MyEllipse, self).__init__(-radius/2, -radius/2, radius, radius)
+        super(MyEllipse, self).__init__(-radius/2, -radius/2, radius)
+        if radius is not None: radius.addItem(self)

The last argument is assumed to be scene and the addition to the scene is moved to a separate line. This assumption is not always true, in the sample above, the arguments are x, y, width, height and the addition to the scene is done elsewhere.

Workaround

Review the automatic changes using git.

changes not commited yet:

git diff --no-color > diff.txt

already commited changes:

git log # find the commit with changes done by pyqt4topyqt5
git show <commit> --no-color > diff.txt

Find new lines with addItem text using regexp: ^\+.*addItem (e.g. with less diff.txt).

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

No branches or pull requests

1 participant