diff --git a/src/Editor/WorldEditor/CSelectInstanceDialog.cpp b/src/Editor/WorldEditor/CSelectInstanceDialog.cpp index fa277879..ce8af7cd 100644 --- a/src/Editor/WorldEditor/CSelectInstanceDialog.cpp +++ b/src/Editor/WorldEditor/CSelectInstanceDialog.cpp @@ -3,13 +3,10 @@ CSelectInstanceDialog::CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pParent) : QDialog(pParent) - , ui(new Ui::CSelectInstanceDialog) , mpEditor(pEditor) , mLayersModel(pEditor, this) , mTypesModel(pEditor, this) - , mValidSelection(false) - , mpLayersInst(nullptr) - , mpTypesInst(nullptr) + , ui(std::make_unique()) { ui->setupUi(this); @@ -45,10 +42,7 @@ CSelectInstanceDialog::CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pPa connect(ui->TypesTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnTreeDoubleClicked(QModelIndex))); } -CSelectInstanceDialog::~CSelectInstanceDialog() -{ - delete ui; -} +CSelectInstanceDialog::~CSelectInstanceDialog() = default; CScriptObject* CSelectInstanceDialog::SelectedInstance() const { diff --git a/src/Editor/WorldEditor/CSelectInstanceDialog.h b/src/Editor/WorldEditor/CSelectInstanceDialog.h index aa20c870..7190d39c 100644 --- a/src/Editor/WorldEditor/CSelectInstanceDialog.h +++ b/src/Editor/WorldEditor/CSelectInstanceDialog.h @@ -6,6 +6,8 @@ #include #include +#include + namespace Ui { class CSelectInstanceDialog; } @@ -20,15 +22,15 @@ class CSelectInstanceDialog : public QDialog CInstancesProxyModel mLayersProxyModel; CInstancesProxyModel mTypesProxyModel; - bool mValidSelection; - CScriptObject *mpLayersInst; - CScriptObject *mpTypesInst; + bool mValidSelection = false; + CScriptObject *mpLayersInst = nullptr; + CScriptObject *mpTypesInst = nullptr; - Ui::CSelectInstanceDialog *ui; + std::unique_ptr ui; public: - explicit CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pParent = 0); - ~CSelectInstanceDialog(); + explicit CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pParent = nullptr); + ~CSelectInstanceDialog() override; CScriptObject* SelectedInstance() const;