diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2024-12-31 10:03:41 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-01-02 07:50:57 +0100 |
| commit | 0da2c2c4ef2219967db87021eece2a60b6e207af (patch) | |
| tree | fc68cf81cb463b075f1855efd59bfed8b4789c9a /examples/sql/sqlbrowser/qsqlconnectiondialog.h | |
| parent | 9c099ef942216d01261c26b60e3727a2a467f12a (diff) | |
sqlbrowser example: use unique_ptr to hold m_ui
The old code used manual memory mangement (raw new/delete) to
(de)allocate the Ui struct. This is so 80s.
Use an owning smart pointer to manage the memory. Ordinarily, this
would have been QScopedPointer, but seeing as that doesn't have a
create() method to hide the raw new, use std::unique_ptr and
std::make_unique() instead.
Amends 2690822428deec4f0c08f4d118d69a7c6036369e.
Pick-to: 6.9 6.8
Change-Id: Icabb9154eb38630855e14094b958af0214516f6b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples/sql/sqlbrowser/qsqlconnectiondialog.h')
| -rw-r--r-- | examples/sql/sqlbrowser/qsqlconnectiondialog.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/sql/sqlbrowser/qsqlconnectiondialog.h b/examples/sql/sqlbrowser/qsqlconnectiondialog.h index b5654ea9133..70dec9e9a86 100644 --- a/examples/sql/sqlbrowser/qsqlconnectiondialog.h +++ b/examples/sql/sqlbrowser/qsqlconnectiondialog.h @@ -6,6 +6,8 @@ #include <QDialog> +#include <memory> + QT_BEGIN_NAMESPACE namespace Ui { @@ -31,7 +33,7 @@ public: void accept() override; private: - Ui::QSqlConnectionDialogUi *m_ui; + const std::unique_ptr<Ui::QSqlConnectionDialogUi> m_ui; }; #endif |
