Thursday, February 10, 2011

Layout

If you are familiar with Java Swing Layout Manager, Qt Framework adopt similiar concept. But in a smarter way...

Qt Layout is very dynamic and you can actually can have a Layout inside another Layout.
So virtually you can create any kind of User Interface. Yes, any kind....

There is one thing that you must take note when you are using Qt Designer. When you have, lets say 10 widget placed on a QDialog and you want to lay it vertically one after another, you might naturally select all the widget using your mouse and then select the Vertical Layout button from the toolbar.

But wait, that is wrong.... By doing this you actually create a Layout and include all the widget to layout, but (yes, there is a but here), the layout is not attached to the QDialog. And this is not what you want because resizing the QDialog have no effect to all your widget.

The correct way of doing it is to not select anything and just click on the Vertical Layout button on the toolbar. Tricky isn't it....

But once you familiar with it you will like it very very much....

No comments:

Post a Comment