Little inconvenience in uic of PyQt6

Detlev Offenbach detlev at die-offenbachs.de
Fri Dec 16 16:51:16 GMT 2022


Hi Phil,

when I use uic.loadUI() in some code to load a Qt form file (*.ui), 
which includes a custom widget derived from QWidget but with a different 
__init__() signature, loading fails.

Example:
QWidget: QWidget.__init__(parent=None)
myWidget: myWidget.__init__(somePath="", parent=None)

In this case uic assigns the containing parent (e.g. a QDialog) to the 
first argument somePath. This leads to an exception eventually. This 
could be prevented if the "setupObject()" method in uiparser.py (line 
218) create the object with a call like (see line 226)

obj = self.factory.createQObject(clsname, name, args, is_attribute, 
parent=parent)

Would a change like this be possible?

Regards,
Detlev

-- 
Detlev Offenbach
detlev at die-offenbachs.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xBD1F26A5DA8A6150.asc
Type: application/pgp-keys
Size: 660 bytes
Desc: OpenPGP public key
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20221216/f2187e91/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20221216/f2187e91/attachment.sig>


More information about the PyQt mailing list