[PyQt] QDesignerPropertySheetExtension property?
maurizio.berti at gmail.com
Sun Dec 17 17:10:06 GMT 2017
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,
propertySheet = sip.cast(propertySheet,
index = propertySheet.indexOf('showMSecsTrailingZeros')
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.
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt