PDA

View Full Version : What is the right sizepolicy for a Qlabel I want it to have only the size of text?



tonnot
13th February 2012, 18:36
I have two labels added at third and fourth position of a hori. layout. I have a last spacerItem. (with expanding).
I want two behaviors :
1.- How to set and 'autoscale' prop for QLabel in order to it has only the width needed.
2.- A layout policy to avoid the labels expand
Now I see how they grows unnecesary.
Any help ?

ChrisW67
13th February 2012, 23:31
What have you tried?

tonnot
14th February 2012, 07:19
Excuse for this late answer.
I have solved the problem using 'fixed' for labels.
Now my problem is the QLineEdit widget. I cant get apply any valid hor. policy. I'd want a similar behavior to the Labels. (That is, a Qlabel automatic fixed width depending on the contents. )
Can I do this ? Thanks
Have I to write a custom QLineEdit widget with a code to calc the size depending on the contents ? (I'm affraid yes,isn't it? )