in case anyone searches this and needs workarounds for their code until the issue is resolved:

in the case of this error being triggered by using the result of QWidget.window() i worked around the error in all cases by explicitly passing a reference to the parent toplevel window all the way down the line to where i needed to reference it,

in the case of this error being triggered by using the result of QWidget.childAt() i had to implement separate logic to track and store a reference to the child widget the mouse cursor was over (which i did using mouse enter and leave events),

in both cases of course being able to use the reference to the toplevel or child obtained dynamically from .window() or .childAt() would have been much much simpler, and i'll revert my workarounds once we have a pyqt5 fix for this.

stephen.

On 05/10/13 18:19, Timothy W. Grove wrote:
Hi Stephen,

I don't really understand the issues here, but I also saw these kinds of
errors cropping up recently when I moved an application from PyQt4 to
PyQt5. I think I had at least three different cases of "AttributeError:
'Qxxxxxx' object has no attribute 'QWidget'". One case I fixed by not
giving a parent to the instance I was creating, simply, 'instance =
SomeWidgetClass(self, parent=None)'; another I fixed by actually giving
it a parent (!), and for the third case I just had to write different
code to accomplish my task.

Sorry this isn't very specific but maybe it will give you something to
try. I'm hoping its just a bug in PyQt5 which will sort itself out
somewhere down the line ...

Best regards,
Tim

On 05/10/2013 07:02, Stephen Gava wrote:
hi there,
i posted an earlier question about one specific instance of this
problem which seemed to relate to using QWidget.childAt() (no
replies), but now i have the same puzzling issue cropping up in
several places in a project i have moved from pyqt4 to pyqt5.

under pyqt4 this code ran fine with none of these exceptions.

under pyqt5 i'm getting exceptions of the kind detailed in the message
title from time to time, ie exceptions where the final error message is:

 AttributeError: 'Qxxxxxx' object has no attribute 'QWidget'

where Qxxxxxx is some kind of widget (in one instance QLabel, in
another couple of cases QMainWindow).

these errors seem like they might be comming from pyqt5 itself, as i
don't reference QWidget as an attribute of any labels or mainwindows
in my own code, however the tracebacks i get only follow the stack in
my own code, in one instance this exception is thrown after a call to
QWidget.childAt() and in some other instances after calls to
QWidget.window()  (which was Qwidget.topLevelWidget() in pyqt4).

as i said the pyqt4 version never throws these exceptions, and i can't
find anything in my code that should be causing this under pyqt5...

does anyone have any advice on how i can at least try to work out
where the issue is coming from? it's definitely caused by something
new/different in ptqt5.

thanks,
stephen.
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to