您的位置:首页 > 编程语言 > Qt开发

QTableWidget column宽度的设置

2011-01-20 20:41 148 查看
qcdataTable->verticalHeader()->setHidden(true);

qcdataTable->setColumnWidth(0, 50);

qcdataTable->setColumnWidth(1, 50);

qcdataTable->horizontalHeader()->setResizeMode(0,QHeaderView::Fixed);

qcdataTable->horizontalHeader()->setStretchLastSection(true);

如果改成

qcdataTable->horizontalHeader()->setResizeMode(QHeaderView::Fixed);

qcdataTable->horizontalHeader()->setStretchLastSection(true);

则除最后一列随边框变化外,其余宽度不能改变。

QHeaderView::Interactive 0

The user can resize the section. The section can also be resized programmatically using

resizeSection
()

QHeaderView::Fixed 2

The user cannot resize the section. The section can only be resized programmatically using

resizeSection
()

QHeaderView::Stretch 1

will automatically resize the section to fill the available space. The size cannot be changed by the user or programmatically

QHeaderView::ResizeToContents 3

will automatically resize the section to its optimal size based on the contents of the entire column or row. The size cannot be changed by the user or programmatically
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: