Qt QTableView使用笔记

Qt 4.7版本下修改

QTableView *tableView = new QTableView;

tableView ->horizontalHeader()->setStretchLastSection(true);//设置列宽饱满
tableView ->horizontalHeader()->setResizeMode(QHeaderView::Fixed);//设置列宽不可编辑,及不能改变列宽大小

Qt 5.7版本下修改

QTableView *tableView = new QTableView;

tableView ->horizontalHeader()->setStretchLastSection(true);//设置列宽饱满
tableView ->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);//设置列宽不可编辑,及不能改变列宽大小

猜你喜欢

转载自blog.csdn.net/qq_36809882/article/details/81075010
今日推荐