-
Notifications
You must be signed in to change notification settings - Fork 94
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
super() does not work for Qt classes #39
Comments
@usiems Is there any known workaround on the python-code side for this? |
When taking the above example, you can always do |
I had a problem yesterday with My Class is a simple Code block which should resize the content of the text. Here is a rough version (not working 100% for the resize). class Code(QPlainTextEdit):
def __init__(self, parent=None):
super(Code, self).__init__(parent)
def heightForWidth(self):
# some calc here
return 30
def sizeHint(self):
original_hint = super(QWidget, self).sizeHint # does not work as described in the description of the issue
original_hint = QPlainTextEdit.sizeHint(self) # exception: QSize object no callable
original_hint = QPlainTextEdit(self).sizeHint # the only which seems to work
return QSize(original_hint.width(), self.heightForWidth(original_hint.width()))
What iss the correct way to get a property? |
So, I believe there is currently no way to do this correctly for properties. |
@usiems Thanks for looking into this. |
I just want to share some insights into this issue, I currently have no intention to fix the issue, as that would be somewhat complicated.
This is an example of what does not work:
The problem boils down to the fact that the method lookup of super() directly accesses the internal tp_dict member of the super classes, which is only filled to an absolute minimum by PythonQt (for performance reasons). Everything else is delivered through tp_getattro calls, but this does not work for super.
I discussed with Florian Link what would have to be done to fill the tp_dict.
We both agreed that this change is somewhat tricky and probably currently not worthwhile.
The text was updated successfully, but these errors were encountered: