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->setCurrentIndex(model->index(0, 0));
|
||||||
|
ui.bookTable->selectRow(0);
|
||||||
createMenuBar();
|
createMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void showError(const QSqlError &err);
|
void showError(const QSqlError &err);
|
||||||
Ui::BookWindow ui;
|
Ui::BookWindow ui;
|
||||||
QSqlRelationalTableModel *model;
|
QSqlRelationalTableModel *model = nullptr;
|
||||||
int authorIdx, genreIdx;
|
int authorIdx = 0, genreIdx = 0;
|
||||||
|
|
||||||
void createMenuBar();
|
void createMenuBar();
|
||||||
};
|
};
|
||||||
|
@ -64,6 +64,9 @@
|
|||||||
<string>Details</string>
|
<string>Details</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout">
|
<layout class="QFormLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
Loading…
Reference in New Issue
Block a user