PDA

View Full Version : Cannot make the LineEdit size to be "fixed"



yren
15th August 2008, 22:55
Even when I set the LineEdit's SizePolicy to "fixed, fixed, 0, 0", the Layout manager still resizes it to the "predered" size when I apply the GridLayout to them. But, the same SizePolicy of a ComboBox keeps its size unchanged when putting it into a layout. Do I miss something ?

Thanks!

spirit
16th August 2008, 15:50
in 4.4.1 it works fine.
can you post your ui?

yren
18th August 2008, 20:03
Please find that in the attachment.

Thank you!

spirit
19th August 2008, 07:26
you need to put all widgets in Settings in QGridLayout by cliking on tool bar.
then set SizePolicy to Fixed for all QLineEdits.
also, you need add main layout (QVBoxLayout) for QGroupBox, QLabel and QTreeWidget.

yren
20th August 2008, 18:28
Thank you for the reply! My problem is that the size of the lineEdit fields cannot stick to the size I set even I tell the SizePolycy to be "fixed". When I put the "Settings" group Box in a GridLayout, the size of my lineEdit grows to its "prefered" size. If you look at the ComboBox, after I set its "SizePolicy" to be "fixed", it will stick to the original size, not the "prefered" size. It seems like the "SizePolicy" setting of the LineEdit doesn't do anything to it.

Yi

spirit
20th August 2008, 18:43
I don't know what you do, but SizePolicy::Fixed works fine for QLineEdit.

yren
21st August 2008, 18:56
It really bothers me that QT Designer is incapable to size the LineEdit according to the requirement in its layout manager. It always wants to make LineEdit at least certain size. If you want to create a small dialog with various LineEdits, each of them only holds 2 or 3 digits, you do not want the LineEdit in the size QT sets for you. I do not want to display a big dialog then resize it by user. Looks like QT is not ready for prime time yet.

jacek
21st August 2008, 19:27
Looks like QT is not ready for prime time yet.
Or maybe you just don't know how to use Qt Designer properly.

yren
21st August 2008, 19:36
That will mostly be the case! Could you post your UI so I can learn how you set them up with the layout manager.

Thanks!

yren
21st August 2008, 20:41
I got it. The Max/Min size need to be specified if I want to control the behavior of Layout Manager.

jacek
22nd August 2008, 01:29
I got it. The Max/Min size need to be specified if I want to control the behavior of Layout Manager.
The other option is to use stretch factors and spacers.