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>
40 lines
774 B
C++
40 lines
774 B
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef QSQLCONNECTIONDIALOG_H
|
|
#define QSQLCONNECTIONDIALOG_H
|
|
|
|
#include <QDialog>
|
|
|
|
#include <memory>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui
|
|
{
|
|
class QSqlConnectionDialogUi;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class QSqlConnectionDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
QSqlConnectionDialog(QWidget *parent = nullptr);
|
|
~QSqlConnectionDialog();
|
|
|
|
QString driverName() const;
|
|
QString databaseName() const;
|
|
QString userName() const;
|
|
QString password() const;
|
|
QString hostName() const;
|
|
int port() const;
|
|
bool useInMemoryDatabase() const;
|
|
|
|
void accept() override;
|
|
|
|
private:
|
|
const std::unique_ptr<Ui::QSqlConnectionDialogUi> m_ui;
|
|
};
|
|
|
|
#endif
|