From 0da2c2c4ef2219967db87021eece2a60b6e207af Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 31 Dec 2024 10:03:41 +0100 Subject: 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 --- examples/sql/sqlbrowser/qsqlconnectiondialog.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/sql/sqlbrowser/qsqlconnectiondialog.h') 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 +#include + QT_BEGIN_NAMESPACE namespace Ui { @@ -31,7 +33,7 @@ public: void accept() override; private: - Ui::QSqlConnectionDialogUi *m_ui; + const std::unique_ptr m_ui; }; #endif -- cgit v1.2.3