QDesignerPropertySheetExtension property?

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

QDesignerPropertySheetExtension property?

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

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: QDesignerPropertySheetExtension property?

Phil Thompson-5
On 17 Dec 2017, at 5:10 pm, Maurizio Berti <[hidden email]> wrote:
>
> 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)

This is certainly wrong as only PyQt knows about QPyDesignerPropertySheetExtension and so Designer couldn't have created an instance of it.

>         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.

There are probably PyQt bugs as well. I doubt if the Designer stuff has ever been used beyond the widget plugins.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt