7.7.2 tableWidget相关函数介绍
单元格相关操作函数
1.构造函数
QTableWidget(QWidget *parent = Q_NULLPTR);
QTableWidget(int rows, int columns, QWidget *parent = Q_NULLPTR);
参数:
Rows :行数量;Columns :列数量;QWidget *parent :父窗口
构造一个7行5列的表格示例:
//构造一个QTableWidget类的实体对象tableWidget
QTableWidget *tableWidget = new QTableWidget(this);
tableWidget->setRowCount(7);//设置行数为7
tableWidget->setColumnCount(5);//设置列数为5
或者
QTableWidget *tableWidget = new QTableWidget(7,5,this);
2.设置行和列的数量
行:
void QTableWidget::setRowC