Qt5 C++ GUI Programming Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

This example focuses more on the layout system of Qt. Qt's layout system allows our application GUI to automatically arrange itself within the given space by arranging the children objects of each widget. The spacer items used in the preceding example help to push the widgets contained in a layout outward to create spacing along the width of the spacer item.

To locate a widget to the middle of the layout, put two spacer items to the layout: one on the left side of the widget and one on the right side of the widget. The widget will then be pushed to the middle of the layout by the two spacers.