diff --git a/examples/sql/books/bookwindow.cpp b/examples/sql/books/bookwindow.cpp index 2ec5459e1b..b7baad48cc 100644 --- a/examples/sql/books/bookwindow.cpp +++ b/examples/sql/books/bookwindow.cpp @@ -89,6 +89,7 @@ BookWindow::BookWindow() ); ui.bookTable->setCurrentIndex(model->index(0, 0)); + ui.bookTable->selectRow(0); createMenuBar(); } diff --git a/examples/sql/books/bookwindow.h b/examples/sql/books/bookwindow.h index ba569292a6..8030516e5b 100644 --- a/examples/sql/books/bookwindow.h +++ b/examples/sql/books/bookwindow.h @@ -22,8 +22,8 @@ private slots: private: void showError(const QSqlError &err); Ui::BookWindow ui; - QSqlRelationalTableModel *model; - int authorIdx, genreIdx; + QSqlRelationalTableModel *model = nullptr; + int authorIdx = 0, genreIdx = 0; void createMenuBar(); }; diff --git a/examples/sql/books/bookwindow.ui b/examples/sql/books/bookwindow.ui index ce8f9f933a..c93726c553 100644 --- a/examples/sql/books/bookwindow.ui +++ b/examples/sql/books/bookwindow.ui @@ -64,6 +64,9 @@ Details + + QFormLayout::ExpandingFieldsGrow +