[PyQt] Custom widgets don't appear unless inside a layout

Lais P. Carmo lais.carmo at lnls.br
Fri Dec 9 11:08:42 GMT 2016


Hi everyone.

I have a little issue with layouts. It seems to be simple thing but I didn't find a solution yet.

I am loading PyQt4 interfaces using the "standard way" (from .ui with loadUi method OR from .py with setupUi method). However custom widgets (derived from QWieget, QLabel etc.) don't appear on the screen unless I put them inside a QLayout objetc. Other qt basic widgets display normally.

Also when I read their size it is always different from what I set, and their x,y coordinates are always turned to zero. It seems that the custom widget loose the main window reference. I explictly set the main window as their parent but the problem remains.


Putting custom widgets inside layout may not seem to be hard, but it is boring to work like this in large interfaces. Iam building a simple app to load interfaces made by users, so I would like the users not to have this need.


Thank you 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/20161209/0d08b436/attachment.html>


More information about the PyQt mailing list