Rapid UI design - tip and trick
-
Hi People,
I would like to know some trick for design an rapid and beautiful UI. The most important for me is the automate alignment between the widgets and the main window.
I work on the design view of the QtCreator and I have a MainWindow object. On it is an TabWidget and I would like take a PushButton on the fist tab. How can I set the Button to it stays every time on the right button corne of the MainWindow. I don't like to use the signals of MainWindow.Regards,
Norbertu.i.: sorry for my english :(
-
Using "layouts" is very straightforward. This "link":http://qt-project.org/doc/qt-4.8/designer-layouts.html will guide you.
-
All placement can be done with "layouts":http://doc.qt.digia.com/4.7/designer-layouts.html and spacers.
Example:
!http://img266.imageshack.us/img266/5715/layoutvv.jpg(layout example)!Notice the grid layouts (little blue grid icon) set inside the main window and the tab.
-
The biggest hurdle when starting to use the creator is to understand how Qt Layouts work. Layouts have an effect only on things inside them, never to the outside. So when you put 3 widgets in your main window and join them with a horizontal layout, they are arranged in a neat horizontal line, but nothing else. The group of three widgets is "loose" in the main window.
In order to put them in relation to the main window, you need a second layout, the "master layout" for the main window. In order to produce that, you select the window (that is some piece of background behind your three widgets) and then chose one of the layouts from the toolbar.