PDA

View Full Version : QVBoxLayout width size limit



QPlace
18th June 2009, 01:33
I am using Qt Designer and I cannot figure out how to set up maximum width size of QVBoxLayout. Say, I have a listview and I enclose it in QVBoxLayout. I can set up maximum width size of listview, but when I stretch layout horizontally the widget itself reaches maximum size and stays there, but QVBoxLayout continues to grow.

wagmare
18th June 2009, 06:24
try changing layoutsizeconstraint property ..

aamer4yu
18th June 2009, 08:03
but when I stretch layout horizontally the widget itself reaches maximum size and stays there, but QVBoxLayout continues to grow.
Reply With Quote
You could set some max size onthe widget u are stretching,,, cant you ?

QPlace
18th June 2009, 13:28
wagmare: That the first thing I did, changed layoutsizeconstraint. I can change the value of it to "SetMinimumSize', or "setMaximumSize", but I don't see the way to set this size anywhere. There are 4 ...Margin parameters, one Spacing and one Stretch, that's all.

Still confused..

wagmare
18th June 2009, 14:54
i think u will try this one also .. but any way consider this ..

in stretch .. try to change the sizeType to fixed and now u try to change width and height of that stretch property .. it will makes in fixed position

mr.Ameer also suggest the same ..

QPlace
18th June 2009, 15:54
Well, I did the following:

Again, in QtDesigner, I have a widget (with fixed maximum width set to 150) inside QVBoxLayout. I changed property "layoutSizeConstraint" to "SetFixedSize" and I changed "layoutStretch" property to 200,250. After these properties are changed I can still enlarge layout size to whatever I want by dragging lower-right corner of it.

Repeating this process by changing "layoutSizeConstraint" to "SetMaximumSize" also does not prevent layout to be enlarged:confused:

luf
18th June 2009, 17:04
Does the size stay fixed in your compiled app?

If so, it's probably how Qt Designer is built. If you want to resize with the mouse, it let's you do it. (which is logical enough).

QPlace
18th June 2009, 17:41
luf:

That was it! Indeed, when the project is build the layout behaves properly. What confused me was that when the constrains are set for a widget I can't change the widget size beyong the limits. It is not the case with layouts. IMHO, it is a subtle inconsistency, but to complain about it using Qt - the best GUI framework - that would be rude.