Little inconvenience in uic of PyQt6
Phil Thompson
phil at riverbankcomputing.com
Fri Jan 13 15:21:26 GMT 2023
On 16/12/2022 16:51, Detlev Offenbach wrote:
> 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?
Done, although not a trivial change.
Phil
More information about the PyQt
mailing list