CInstanceModel: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 03:48:56 -04:00
parent 832889f029
commit 6962f8e026
2 changed files with 15 additions and 21 deletions

View File

@ -31,11 +31,6 @@ CInstancesModel::CInstancesModel(CWorldEditor *pEditor, QObject *pParent)
: QAbstractItemModel(pParent) : QAbstractItemModel(pParent)
, mpEditor(pEditor) , mpEditor(pEditor)
, mpScene(pEditor->Scene()) , mpScene(pEditor->Scene())
, mpArea(nullptr)
, mpCurrentGame(nullptr)
, mModelType(EInstanceModelType::Layers)
, mShowColumnEnabled(true)
, mChangingLayout(false)
{ {
mBaseItems << "Script"; mBaseItems << "Script";
@ -50,9 +45,7 @@ CInstancesModel::CInstancesModel(CWorldEditor *pEditor, QObject *pParent)
connect(mpEditor, SIGNAL(InstancesLayerChanged(QList<CScriptNode*>)), this, SLOT(InstancesLayerPostChange(QList<CScriptNode*>))); connect(mpEditor, SIGNAL(InstancesLayerChanged(QList<CScriptNode*>)), this, SLOT(InstancesLayerPostChange(QList<CScriptNode*>)));
} }
CInstancesModel::~CInstancesModel() CInstancesModel::~CInstancesModel() = default;
{
}
QVariant CInstancesModel::headerData(int Section, Qt::Orientation Orientation, int Role) const QVariant CInstancesModel::headerData(int Section, Qt::Orientation Orientation, int Role) const
{ {

View File

@ -27,23 +27,24 @@ public:
private: private:
CWorldEditor *mpEditor; CWorldEditor *mpEditor;
CScene *mpScene; CScene *mpScene;
CGameArea *mpArea; CGameArea *mpArea = nullptr;
CGameTemplate *mpCurrentGame; CGameTemplate *mpCurrentGame = nullptr;
EInstanceModelType mModelType; EInstanceModelType mModelType{EInstanceModelType::Layers};
QList<CScriptTemplate*> mTemplateList; QList<CScriptTemplate*> mTemplateList;
QStringList mBaseItems; QStringList mBaseItems;
bool mShowColumnEnabled; bool mShowColumnEnabled = true;
bool mChangingLayout; bool mChangingLayout = false;
public: public:
explicit CInstancesModel(CWorldEditor *pEditor, QObject *pParent = 0); explicit CInstancesModel(CWorldEditor *pEditor, QObject *pParent = nullptr);
~CInstancesModel(); ~CInstancesModel() override;
QVariant headerData(int Section, Qt::Orientation Orientation, int Role) const;
QModelIndex index(int Row, int Column, const QModelIndex& rkParent = QModelIndex()) const; QVariant headerData(int Section, Qt::Orientation Orientation, int Role) const override;
QModelIndex parent(const QModelIndex& rkChild) const; QModelIndex index(int Row, int Column, const QModelIndex& rkParent = QModelIndex()) const override;
int rowCount(const QModelIndex& rkParent) const; QModelIndex parent(const QModelIndex& rkChild) const override;
int columnCount(const QModelIndex& rkParent) const; int rowCount(const QModelIndex& rkParent) const override;
QVariant data(const QModelIndex& rkIndex, int Role) const; int columnCount(const QModelIndex& rkParent) const override;
QVariant data(const QModelIndex& rkIndex, int Role) const override;
void SetModelType(EInstanceModelType Type); void SetModelType(EInstanceModelType Type);
void SetShowColumnEnabled(bool Enabled); void SetShowColumnEnabled(bool Enabled);