官方文档:
http://doc.qt.nokia.com/4.5/qgridlayout.html#rowStretch是这么说的:
- void QGridLayout::setColumnStretch ( int column, int stretch )
- Sets the stretch factor of column column to stretch. The first column is number 0.
- The stretch factor is relative to the other columns in this grid. Columns with a higher stretch factor take more of the available space.
- The default stretch factor is 0. If the stretch factor is 0 and no other column in this table can grow at all, the column may still grow.
- An alternative approach is to add spacing using addItem() with a QSpacerItem.
但是还是没有看懂。
究竟setColumnStretch 是什么意思呢?我在给QGridLayout kbdGrid;添加按钮之前,用
- kbdGrid->setSpacing(0);
- kbdGrid->setMargin(0);
这样之后,运行程序,然后最大化窗口,每个按钮在水平方向是紧紧相邻了,
但是在竖直方向也就是不同行之间的按钮,上下还有很大的空白,
如何设置按钮在上下左右都没有空白呢?