Почему-то не отображаются названия столбцов QSqlTableModel.
dbViewer::dbViewer()
{
model = new QSqlTableModel(this);
model->setTable("photos");
model->setHeaderData(0, Qt::Horizontal, "id");
model->setHeaderData(1, Qt::Horizontal, "file");
model->setHeaderData(2, Qt::Horizontal, "floor");
model->setHeaderData(3, Qt::Horizontal, "order");
model->select();
view = new QTableView;
view->setModel(model);
view->setSelectionMode(QAbstractItemView::SingleSelection);
view->setSelectionBehavior(QAbstractItemView::SelectRows);
view->resizeColumnsToContents();
view->setEditTriggers(QAbstractItemView::NoEditTriggers);
QHeaderView *header = view->horizontalHeader();
header->setStretchLastSection(true);
...
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(view, 0, 0, 1, 3);
setLayout(mainLayout);
Сверху: