qt6-bb10/examples/sql/sqlbrowser
Marc Mutz 2325914112 sqlbrowser example: use idiomatic Qt [2/3]: use button-box / override accept()
- The old code used two QPushButtons in a QHBoxLayout to provide
  Ok/Cancel buttons. This hard-codes the positions and text (and
  icons) of these buttons, instead of adapting to the platform style.

  The new code simply uses QDialogButtonBox, which is designed for
  this purpose.

- Also, the old code connected the Ok button's clicked() signal to a
  custom slot that then called QDialog::accept(). This means that the
  code in the custom slot is not executed when the dialog is accepted
  by other means (e.g. return press in one of the line edits
  ("auto-default"), though I'm not sure here).

  The new code uses the idiomatic Qt way of overriding
  QDialog::accept() instead, and connects the button-box's accepted()
  signal to it. This is done in the .ui file, so it already works in
  Designer preview.

- Finally, the old code made a manual connection from the Cancel
  button to QDialog::reject().

  The new code uses the Qt idiom of connecting in the .ui file
  directly, using QDialogButtonBox::rejected() as the signal.

Amends 2690822428, which, however,
inherited all of the above from even older code.

Change-Id: I83afd6156a0811e0c0f99f2480625ea6b69ff78b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3419c299369ac1da94ba5710aaf5f5f65c38c33c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8dbd0828e94497ab6ee6c5d924e51b4778e5bccc)
2025-01-02 19:19:41 +00:00
..
CMakeLists.txt CMake: Add deployment API to our examples 2024-03-22 20:23:52 +01:00
browser.cpp SQL/QSqlField: deprecate internal functions setSqlType()/typeID() 2024-03-10 18:16:00 +00:00
browser.h Examples/sqlbrowser: improve coding style 2024-01-19 17:27:25 +01:00
browserwidget.ui add strategy support to sqlbrowser example 2012-03-06 06:34:33 +01:00
connectionwidget.cpp Examples/sqlbrowser: improve coding style 2024-01-19 17:27:25 +01:00
connectionwidget.h Examples/sqlbrowser: improve coding style 2024-01-19 17:27:25 +01:00
main.cpp Examples/sqlbrowser: improve coding style 2024-01-19 17:27:25 +01:00
qsqlconnectiondialog.cpp sqlbrowser example: use idiomatic Qt [2/3]: use button-box / override accept() 2025-01-02 19:19:41 +00:00
qsqlconnectiondialog.h sqlbrowser example: use idiomatic Qt [2/3]: use button-box / override accept() 2025-01-02 19:19:41 +00:00
qsqlconnectiondialog.ui sqlbrowser example: use idiomatic Qt [2/3]: use button-box / override accept() 2025-01-02 19:19:41 +00:00
sqlbrowser.pro qtlite: Skip building examples when configured with no-feature-itemviews 2018-01-12 07:58:20 +00:00