diff options
author | Paul Wicking <paul.wicking@qt.io> | 2018-06-08 11:59:52 +0200 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2018-06-08 13:03:10 +0000 |
commit | dbad7bd2345df603a98d7cd35fceb2e9c1998250 (patch) | |
tree | 72d7bdfc3d315984f1226d110c4e89cf1aa8df19 /examples/sql/books/bookwindow.cpp | |
parent | 73b2d7f612c0c01ac55da52612c198b5cac0fa26 (diff) |
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>
Diffstat (limited to 'examples/sql/books/bookwindow.cpp')
-rw-r--r-- | examples/sql/books/bookwindow.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/sql/books/bookwindow.cpp b/examples/sql/books/bookwindow.cpp index d85b438956..3aac5b55b7 100644 --- a/examples/sql/books/bookwindow.cpp +++ b/examples/sql/books/bookwindow.cpp @@ -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)); |