diff --git a/src/Editor/WorldEditor/WCreateTab.cpp b/src/Editor/WorldEditor/WCreateTab.cpp index 532a7f9f..a63a2d8c 100644 --- a/src/Editor/WorldEditor/WCreateTab.cpp +++ b/src/Editor/WorldEditor/WCreateTab.cpp @@ -7,8 +7,7 @@ WCreateTab::WCreateTab(CWorldEditor *pEditor, QWidget *pParent /*= 0*/) : QWidget(pParent) - , ui(new Ui::WCreateTab) - , mpSpawnLayer(nullptr) + , ui(std::make_unique()) { ui->setupUi(this); @@ -20,10 +19,7 @@ WCreateTab::WCreateTab(CWorldEditor *pEditor, QWidget *pParent /*= 0*/) connect(ui->SpawnLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSpawnLayerChanged(int))); } -WCreateTab::~WCreateTab() -{ - delete ui; -} +WCreateTab::~WCreateTab() = default; bool WCreateTab::eventFilter(QObject *pObj, QEvent *pEvent) { diff --git a/src/Editor/WorldEditor/WCreateTab.h b/src/Editor/WorldEditor/WCreateTab.h index 2c9cb4b8..723988e8 100644 --- a/src/Editor/WorldEditor/WCreateTab.h +++ b/src/Editor/WorldEditor/WCreateTab.h @@ -5,6 +5,8 @@ #include #include +#include + namespace Ui { class WCreateTab; } @@ -13,15 +15,16 @@ class WCreateTab : public QWidget { Q_OBJECT CWorldEditor *mpEditor; - CScriptLayer *mpSpawnLayer; + CScriptLayer *mpSpawnLayer = nullptr; public: - explicit WCreateTab(CWorldEditor *pEditor, QWidget *parent = 0); - ~WCreateTab(); - bool eventFilter(QObject *, QEvent *); + explicit WCreateTab(CWorldEditor *pEditor, QWidget *parent = nullptr); + ~WCreateTab() override; + + bool eventFilter(QObject *, QEvent *) override; // Accessors - inline CScriptLayer* SpawnLayer() const { return mpSpawnLayer; } + CScriptLayer* SpawnLayer() const { return mpSpawnLayer; } public slots: void OnActiveProjectChanged(CGameProject *pProj); @@ -29,7 +32,7 @@ public slots: void OnSpawnLayerChanged(int LayerIndex); private: - Ui::WCreateTab *ui; + std::unique_ptr ui; }; #endif // WCREATETAB_H