[PyQt] Designer formEditor.propertyEditor().propertyChanged QVariant issue/crash

Maurizio Berti maurizio.berti at gmail.com
Mon Feb 12 18:19:44 GMT 2018

As far as I know there is no straight way to access the QtDesigner
propertyEditor, so I've been using some "dirty" workaround to access the
propertyChanged signal for custom properties.
When the custom widget is initialized, I set the formEditor as attribute of
the plugin class:

    def initialize(self, formEditor):
        if self.initialized:
        self.formEditor = formEditor

Then, in the createWidget() method I can access the propertyEditor and its
propertyChanged signal:

    def createWidget(self, parent):
        widget = TestWidget(parent)
        if self.formEditor.propertyEditor():


If I use "common" property types, such as QColor, QAlignment, or any kind
of QFlag, everything works fine. Unfortunally, it seems that QEnums have
issues with the python conversion, resulting in a "TypeError: unable to
convert a C++ 'QVariant' instance to a Python object" in both PyQt4 and
PyQt5. While Qt4 just seems to ignore the error, this results in a crash of
Designer under Qt5.
As I can understand, there is no way to avoid this behavior, since the
signal cannot be overloaded, and I sincerely doubt that this issue depends
on the way I access the formEditor/propertyEditor.

Tested under PyQt 4.12 and 5.7.1.


È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180212/12a83cbe/attachment.html>

More information about the PyQt mailing list