CoAL
CoAL

Reputation: 1

Labels not displaying correctly

In Qt designer when I make my UI's, the UI displays correctly. When I convert it to Python code and run the program it looks different and the text doesn't fit correctly.

QT Designer:

enter image description here

When I convert it to Python code and run the program:

https://i.sstatic.net/ekvoK.png

Upvotes: 0

Views: 164

Answers (1)

eyllanesc
eyllanesc

Reputation: 244301

The problem is caused because the .ui to .py converter (pyuic) does not use the same methodology as the QtDesigner previewer. This difference not only occurs with the QLabels but with other components, but since they are minimal differences then these are not observable.

A workaround for this case is to use the adjustSize() method after setting the text:

the_qlabel.adjustSize()

Upvotes: 1

Related Questions