[PyQt] Responsive thead in preview mode in Qt Designer

Lais P. Carmo lais.carmo at lnls.br
Fri Aug 5 19:19:08 BST 2016


Hello,


I would like to create an user-friendly GUI designer using Qt Designer and custom widgets.


I imagined an environment using Qt Design where customized widgets are available in the widgets box. The user will compose an interface by just drag-and-droping them in a form, connecting them only with the available signals and setting properties. After that the user runs the preview mode (ctrl+R) and the form is ready to use.

I think the preview mode fits what I have in mind because it is responsive with every widget and connection I made until now. Its is way to make the process of making an interface to be automatic for users without programming knowledge.


First I made I prototype of an simple custom widget (label): this is a sub class of QLabel which contains a QThread. This QThread reads a variable every 1 second and emits a signal with its value. The custom label class gets this signal and updates its text property with the received value. When I write a simple application that imports it, it runs smoothly: the custom labels updates its text every 1 second.


Then I made a plugin with this class in order to use it inside Qt Designer. I can create a form with the custom label, convert the .ui to .py, write an application importing it and run. Again it works well!


Now I need the custom label to be responsive when one enters the preview mode, in other words, with its text updating every second. However the updates doesn't occur, the text keeps fronzen, except when I move/resize the custom label in the edit mode (or anything that forces the Designer to update its entire GUI).

Recently I used a Designer plugin that does exactly the same thing, but its written in C++. I need to have this effect in Python.

To make a summary: plugins are responsive in the preview mode but for the custom ones containing QThreads.


Is there a way to do this? Any other way to run the composed interface automatically in Qt Desinger? Searched every where but got nothing.

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       lais.carmo at lnls.br
www.lnls.cnpem.br<http://www.lnls.cnpem.br>
'''
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160805/f251ff19/attachment.html>


More information about the PyQt mailing list