[PyQt] PyqtProperty types

Lais P. Carmo lais.carmo at lnls.br
Mon Aug 29 18:27:01 BST 2016


Two questions about pyqtProperties:

1) When making plugins for QtDesigner, I expose them in the widget class escope with QtCore.pyqtProperty, passing as parameters the type of the property and functions to get and set, for example:

my_property = pyqtProperty('QString', getMyProperty, setMyProperty, None)

However, this time I would like to use types as int and float. Every time I try I got errors like this:

"TypeError: unable to convert a Python 'str' object to a C++ 'double' instance"

What is the correct way to define types different from QString?

2) How can I create a property which is composed by others? An example of this kind is the property geometry of QWidget class: it is composed by X, Y, Width and Height properties.

Thanks for any help! :)


LaĆ­s Pessine do Carmo

Computer Engineering Trainee at Beamline Software Group

Brazilian Synchrotron Light Laboratory - LNLS
Center of Research in Energy and Materials - CNPEM
+ 55 (11) 94233-7721   /   Ramal 1226
http://lnls.cnpem.br                     lais.carmo at lnls.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160829/8424a27b/attachment.html>

More information about the PyQt mailing list