[PyQt] PyqtProperty types

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


I forgot to mention: I am using PyQt5 under Linux.


'''

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


________________________________
From: Lais P. Carmo
Sent: Monday, August 29, 2016 2:27 PM
To: pyqt at riverbankcomputing.com
Subject: PyqtProperty types


Hi,


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/15d09d7b/attachment-0001.html>


More information about the PyQt mailing list