WCreateTab: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 06:50:41 -04:00
parent 036eed3ec8
commit 5212b73229
2 changed files with 11 additions and 12 deletions

View File

@ -7,8 +7,7 @@
WCreateTab::WCreateTab(CWorldEditor *pEditor, QWidget *pParent /*= 0*/) WCreateTab::WCreateTab(CWorldEditor *pEditor, QWidget *pParent /*= 0*/)
: QWidget(pParent) : QWidget(pParent)
, ui(new Ui::WCreateTab) , ui(std::make_unique<Ui::WCreateTab>())
, mpSpawnLayer(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -20,10 +19,7 @@ WCreateTab::WCreateTab(CWorldEditor *pEditor, QWidget *pParent /*= 0*/)
connect(ui->SpawnLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSpawnLayerChanged(int))); connect(ui->SpawnLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSpawnLayerChanged(int)));
} }
WCreateTab::~WCreateTab() WCreateTab::~WCreateTab() = default;
{
delete ui;
}
bool WCreateTab::eventFilter(QObject *pObj, QEvent *pEvent) bool WCreateTab::eventFilter(QObject *pObj, QEvent *pEvent)
{ {

View File

@ -5,6 +5,8 @@
#include <Core/Resource/Script/CGameTemplate.h> #include <Core/Resource/Script/CGameTemplate.h>
#include <QWidget> #include <QWidget>
#include <memory>
namespace Ui { namespace Ui {
class WCreateTab; class WCreateTab;
} }
@ -13,15 +15,16 @@ class WCreateTab : public QWidget
{ {
Q_OBJECT Q_OBJECT
CWorldEditor *mpEditor; CWorldEditor *mpEditor;
CScriptLayer *mpSpawnLayer; CScriptLayer *mpSpawnLayer = nullptr;
public: public:
explicit WCreateTab(CWorldEditor *pEditor, QWidget *parent = 0); explicit WCreateTab(CWorldEditor *pEditor, QWidget *parent = nullptr);
~WCreateTab(); ~WCreateTab() override;
bool eventFilter(QObject *, QEvent *);
bool eventFilter(QObject *, QEvent *) override;
// Accessors // Accessors
inline CScriptLayer* SpawnLayer() const { return mpSpawnLayer; } CScriptLayer* SpawnLayer() const { return mpSpawnLayer; }
public slots: public slots:
void OnActiveProjectChanged(CGameProject *pProj); void OnActiveProjectChanged(CGameProject *pProj);
@ -29,7 +32,7 @@ public slots:
void OnSpawnLayerChanged(int LayerIndex); void OnSpawnLayerChanged(int LayerIndex);
private: private:
Ui::WCreateTab *ui; std::unique_ptr<Ui::WCreateTab> ui;
}; };
#endif // WCREATETAB_H #endif // WCREATETAB_H