Doc: Sql example Books lock rating column width

Lock the width of the rating column to prohibit the contents to escape
the bounds of the column upon resize.

Task-number: QTBUG-68652
Change-Id: I5c744833b19a8e5bcf88ef1b9ab657ac81f5aa50
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
This commit is contained in:
Paul Wicking 2018-06-08 11:59:52 +02:00
parent 73b2d7f612
commit dbad7bd234

View File

@ -115,6 +115,11 @@ BookWindow::BookWindow()
ui.genreEdit->setModelColumn(
model->relationModel(genreIdx)->fieldIndex("name"));
// Lock and prohibit resizing of the width of the rating column:
ui.bookTable->horizontalHeader()->setSectionResizeMode(
model->fieldIndex("rating"),
QHeaderView::ResizeToContents);
QDataWidgetMapper *mapper = new QDataWidgetMapper(this);
mapper->setModel(model);
mapper->setItemDelegate(new BookDelegate(this));