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