• 14275阅读
  • 1回复

QGrid 中setColumnStretch是什么意思?怎样让按钮占满整个空间? [复制链接]

上一主题 下一主题
离线vaqeteart
 

只看楼主 倒序阅读 楼主  发表于: 2009-12-18
官方文档:
http://doc.qt.nokia.com/4.5/qgridlayout.html#rowStretch
是这么说的:
  1. void QGridLayout::setColumnStretch ( int column, int stretch )
  2. Sets the stretch factor of column column to stretch. The first column is number 0.
  3. The stretch factor is relative to the other columns in this grid. Columns with a higher stretch factor take more of the available space.
  4. 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.
  5. An alternative approach is to add spacing using addItem() with a QSpacerItem.

但是还是没有看懂。
究竟setColumnStretch 是什么意思呢?

我在给QGridLayout kbdGrid;添加按钮之前,用
  1. kbdGrid->setSpacing(0);
  2. kbdGrid->setMargin(0);

这样之后,运行程序,然后最大化窗口,每个按钮在水平方向是紧紧相邻了,
但是在竖直方向也就是不同行之间的按钮,上下还有很大的空白,如何设置按钮在上下左右都没有空白呢?
离线dbzhang800

只看该作者 1楼 发表于: 2009-12-18
设置你的按钮竖直方向的 sizePolicy
快速回复
限100 字节
 
上一个 下一个