Examples: Revamp sql/books
* use nullptr * use member init * set ExpandingFieldsGrow fieldGrowthPolicy for QFormLayout, which makes it behaviors similar on macOS as other platforms * select first row to make up/down keys works by default Pick-to: 6.5 6.6 Change-Id: I25d9869d2ca1c7274c2b750aada8270734787546 Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
parent
728b991b93
commit
ed1fbc7a88
@ -89,6 +89,7 @@ BookWindow::BookWindow()
|
||||
);
|
||||
|
||||
ui.bookTable->setCurrentIndex(model->index(0, 0));
|
||||
ui.bookTable->selectRow(0);
|
||||
createMenuBar();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
};
|
||||
|
@ -64,6 +64,9 @@
|
||||
<string>Details</string>
|
||||
</property>
|
||||
<layout class="QFormLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
|
Loading…
Reference in New Issue
Block a user