CAboutDialog: Make use of unique_ptr

This commit is contained in:
Lioncash 2020-06-28 07:08:43 -04:00
parent d7ee7fe22d
commit 464b417d24
2 changed files with 7 additions and 8 deletions

View File

@ -4,7 +4,7 @@
CAboutDialog::CAboutDialog(QWidget *parent) : CAboutDialog::CAboutDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::CAboutDialog) ui(std::make_unique<Ui::CAboutDialog>())
{ {
ui->setupUi(this); ui->setupUi(this);
@ -13,7 +13,4 @@ CAboutDialog::CAboutDialog(QWidget *parent) :
ui->AboutLabel->setText(LabelText); ui->AboutLabel->setText(LabelText);
} }
CAboutDialog::~CAboutDialog() CAboutDialog::~CAboutDialog() = default;
{
delete ui;
}

View File

@ -3,6 +3,8 @@
#include <QDialog> #include <QDialog>
#include <memory>
namespace Ui { namespace Ui {
class CAboutDialog; class CAboutDialog;
} }
@ -12,11 +14,11 @@ class CAboutDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit CAboutDialog(QWidget *parent = 0); explicit CAboutDialog(QWidget *parent = nullptr);
~CAboutDialog(); ~CAboutDialog() override;
private: private:
Ui::CAboutDialog *ui; std::unique_ptr<Ui::CAboutDialog> ui;
}; };
#endif // CABOUTDIALOG_H #endif // CABOUTDIALOG_H