布局管理
基本布局:
Qt提供了QVBoxLayout类、QHBoxLayou类、QGridLayout类等基本布局管理,分别是垂直排列布局、水平排列布局、网格排列布局,它们的继承关系如下图所示:
(一)垂直布局
QVBoxLayout:QVBoxLayout(垂直布局),垂直地排列所需地控件或布局
最简单的用法:
QWidget *window = new QWidget;
QPushButton *button1 = new QPushButton("One");
QPushButton *button2 = new QPushButton("Two");
QPushButton *button3 = new QPushButton("Three");
QPushButton *button4 = new QPushButton("Four");
QPushButton *button5 = new QPushButton("Five");
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(button1);
layout->addWidget(button2);
layout->addW