答案 0 :(得分:0)
默认情况下,窗口管理器决定主窗口的初始位置,通常它是屏幕的中心(至少在Windows上)。如果您想要一些自定义位置,请致电QWidget::move
。
setDefaultSectionSize
是QHeaderView
函数,因此您需要将其称为table->horizontalHeader ()->setDefaultSectionSize ()
。
您应该使用table->horizontalHeader ()->setHighlightSections (false)
,但我不确定。
答案 1 :(得分:0)
1)这可以通过谷歌找到:(link)
QMainWindow w;
int width = w.frameGeometry().width();
int height = w.frameGeometry().height();
QDesktopWidget wid;
int screenWidth = wid.screen()->width();
int screenHeight = wid.screen()->height();
w.setGeometry((screenWidth/2)-(width/2),(screenHeight/2)-(height/2),width,height);
w.show();
2)好吧,如果你想对defaultSectionSize
使用QTableView
,你应该从它的水平标题实例中调用它,tableView->horizontalHeader ()->setDefaultSectionSize (x)
可以访问它。
虽然如果你想在未来的某个时候将它们设置为默认值,可能会使用tableView->model ()->columnCount ()
迭代所有这些默认设置,并且每个都会调用setColumnWidth
。
3)正如课程setHighlightSections
的{{3}} QHeaderView
中提到的那样负责,所以如果你不想要它们,你必须致电tableView->horizontalHeader ()->setHighlightSections (false)
粗体。
答案 2 :(得分:0)
是的,您需要了解有关Qt模型/视图的更多信息,我希望this source可以帮助您。这是一些例子。