Designer formEditor.propertyEditor().propertyChanged QVariant issue/crash

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Designer formEditor.propertyEditor().propertyChanged QVariant issue/crash

Maurizio Berti
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

PyQt mailing list    [hidden email]