PDA

View Full Version : Hi all. I give up (not really, but yes, kind of)



tachoknight
4th December 2010, 02:45
Hi all-

I admit I just don't get QT's layouts and spacers. Every time I think I know what's going on, QT Creator does something different and I am back to square one.

In this case, and it's just an example, I have two push buttons I want to make small; they just have labels "A" and "B". I resize them to the right dimensions, set horizontal and vertical policies to "fixed", then I apply a horizontal layout, and suddenly the buttons are reset to their original size.

I get the concept of layouts, I can lay stuff out in grids, vertical, horizontal, etc., and that they can be nested and so forth, but what I'm having such a hard time with is telling QT "there are just some things I want you to leave alone. Period." None of the websites or documentation I've found seems to address this particular aspect.

Is there any way to do this? This is my big "missing piece" of QT; I'm absolutely in love with the framework, the classes, everything...it's just this one thing that I can't seem to have a solution for.

Thanks for any info,

Tachoknight

wysota
4th December 2010, 02:57
In this case, and it's just an example, I have two push buttons I want to make small; they just have labels "A" and "B". I resize them to the right dimensions, set horizontal and vertical policies to "fixed", then I apply a horizontal layout, and suddenly the buttons are reset to their original size.
This is because QPushButton has a minimal size hint set which means it can never be smaller than 80x25 (or something like that) when controlled by a layout. Use QToolButton instead.


I get the concept of layouts, I can lay stuff out in grids, vertical, horizontal, etc., and that they can be nested and so forth, but what I'm having such a hard time with is telling QT "there are just some things I want you to leave alone. Period."
Set the size policy to Ignore.