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*/)
: QWidget(pParent)
, ui(new Ui::WCreateTab)
, mpSpawnLayer(nullptr)
, ui(std::make_unique<Ui::WCreateTab>())
{
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)
{

View File

@ -5,6 +5,8 @@
#include <Core/Resource/Script/CGameTemplate.h>
#include <QWidget>
#include <memory>
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::WCreateTab> ui;
};
#endif // WCREATETAB_H