[PyQt] QDesignerPropertySheetExtension property?

Maurizio Berti maurizio.berti at gmail.com
Sun Dec 17 17:10:06 GMT 2017


Hello,
I'm writing a custom widget with a plugin for Designer in PyQt 5.7.
What I wanted to do is to enable/disable certain properties (almost like
the "checked" property for QPushButton, which is disabled if "checkable" is
not checked). Since I wasn't able to find a way to obtain this, I tried
another approach, by using QDesignerPropertySheetExtension's setVisible.
My implementation connects the formEditor.propertyEditor().propertyChanged
signal to a custom slot. In the slot I access the extension like this:

        propertySheet = self.manager.extension(widget,
'org.qt-project.Qt.Designer.PropertySheet')
        propertySheet = sip.cast(propertySheet,
QtDesigner.QPyDesignerPropertySheetExtension)
        index = propertySheet.indexOf('showMSecsTrailingZeros')

QtDesigner.QPyDesignerPropertySheetExtension.setProperty(propertySheet,
index, False)
        propertySheet.setVisible(index, False)


Unfortunally, it seems that there's a problem in the pyqt implementation,
since property() and setProperty() do not behave as described in the
documentation (accepting the index argument), and the setVisible() function
does nothing at all.
As further confirmation of this, if I look in the help
for QDesignerPropertySheetExtension.property(), the description is the same
as any other QObject: property(self, str) -> any. I can see the same in
PyQt 5.9 on windows.

I'd like to know if I'm doing something wrong (I'm pretty new to writing
custom widgets) or if there is actually a bug.

Thank you,
Maurizio

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


More information about the PyQt mailing list