简体   繁体   English

在QTableView中拟合列

[英]Fitting columns in QTableView

In my TableModel I've two columns. 在我的TableModel中,我有两列。 This model is connected to the TableView. 此模型连接到TableView。 How can I set them up so those two columns fill the tableView so there is no free space? 我如何设置它们以便这两列填充tableView所以没有可用空间?
EDIT: 编辑:
在此输入图像描述

Try this: 尝试这个:

tableView->horizontalHeader()->setStretchLastSection(true);
tableView->resizeColumnsToContents(); // not necessarily but can make look better

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM