Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Rapid UI design - tip and trick
moravas last edited by
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.
u.i.: sorry for my english :(
Code_ReaQtor last edited by
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.
Notice the grid layouts (little blue grid icon) set inside the main window and the tab.
Batox last edited by
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.