QPyDesignerCustomWidgetPlugin trouble with propertyEditor



  • Hi! I try to realize self plugin fot QtDesigner and gain control over dynamic properties in GUI via QPyDesignerCustomWidgetPlugin. But in the initialize function, the propertyEditor () method returns None. What am I doing wrong?
    Thank you in advance.

    Duplicate in Russian
    Здравствуйте! Я пытаюсь реализовать плагин для QtDesigner и управлять динамическими свойствами через GUI с помощью QPyDesignerCustomWidgetPlugin. Но в функции initialize метод propertyEditor() возвращает None. Что я делаю не так? Заранее спасибо.

    
    class VBWidgetPlugin(QtDesigner.QPyDesignerCustomWidgetPlugin):
    
        create_property = QtCore.pyqtSignal(QtCore.QObject)
    
        def __init__(self, parent=None):
            super(VBWidgetPlugin, self).__init__(parent)
            self.initialized = False
            self.factory = None
            self.manager = None
            self.button = None
            self.property_manager = None
            self.create_property.connect(self.identify)
    
        def initialize(self, formEditor):
            if self.initialized:
                return
                
            self.property_manager = formEditor.propertyEditor()
            if self.manager:
                self.factory = VBWidgetExtensionFactory(self.manager)
                self.manager.registerExtensions(self.factory, Q_TYPEID['QPyDesignerPropertySheetExtension'])
            self.initialized = True
    
        def isInitialized(self):
            return self.initialized
    
        def createWidget(self, parent):
            self.widget = VBWidget(parent)
            self.widget.installEventFilter(self)
            return self.widget
    ``


  • You need to provide a MRE (Minimal Reproducible Example). What you have provided cannot be copy/pasted and ran which means anyone trying to figure out your issue is going to have to create code of their own which may not match what you are doing thus they may not get the issue you are having. Do yourself a favor and provide an MRE so that someone can answer your question quicker and more accurately


Log in to reply