QTableView setSortingEnabled后setStretchLastSection失效

QTableView 不设置setSectionResizeMode时,当前表格进行排序后,setStretc […]

QTableView 不设置setSectionResizeMode时,当前表格进行排序后,setStretchLastSection将失效。

ui->tableView->setSortingEnabled(true);
ui->tableView->horizontalHeader()->setStretchLastSection(true);

设置后

ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
版权声明
文章标题:QTableView setSortingEnabled后setStretchLastSection失效
文章链接:https://blog.chiyuba.com/houduanjishu/qt/183.html
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布,转载或引用请注明出处。
温馨提示:本文最后更新于 2021年9月9日,部分内容可能存在时效性,请注意甄别。

相关推荐

更多教程

评论