【问题标题】:Fitting columns in QTableView在 QTableView 中拟合列
【发布时间】:2011-12-13 10:12:36
【问题描述】:

在我的 TableModel 中有两列。该模型连接到 TableView。我该如何设置它们以便这两列填充 tableView 以便没有可用空间?
编辑:

【问题讨论】:

标签: c++ qt grid qtableview


【解决方案1】:

试试这个:

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

【讨论】:

  • 在我的界面中看不到 tableView setStretchLastSection
  • 那么,你如何声明你的表格视图?
  • 我已根据我的对话框将其从 qt 的项目视图部分/模型中拖出。
  • tableView->horizo​​ntalHeader()->setStretchLastSection(true);谢谢
  • 我的错误,错过了水平标题。现在更新答案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-08-08
  • 2014-12-28
  • 2019-03-11
  • 1970-01-01
  • 2013-09-30
  • 1970-01-01
  • 2013-07-14
相关资源
最近更新 更多