CSelectInstanceDialog: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 05:50:57 -04:00
parent 51ba06f7c4
commit 5a041dd474
2 changed files with 10 additions and 14 deletions

View File

@ -3,13 +3,10 @@
CSelectInstanceDialog::CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pParent) CSelectInstanceDialog::CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pParent)
: QDialog(pParent) : QDialog(pParent)
, ui(new Ui::CSelectInstanceDialog)
, mpEditor(pEditor) , mpEditor(pEditor)
, mLayersModel(pEditor, this) , mLayersModel(pEditor, this)
, mTypesModel(pEditor, this) , mTypesModel(pEditor, this)
, mValidSelection(false) , ui(std::make_unique<Ui::CSelectInstanceDialog>())
, mpLayersInst(nullptr)
, mpTypesInst(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -45,10 +42,7 @@ CSelectInstanceDialog::CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pPa
connect(ui->TypesTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnTreeDoubleClicked(QModelIndex))); connect(ui->TypesTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnTreeDoubleClicked(QModelIndex)));
} }
CSelectInstanceDialog::~CSelectInstanceDialog() CSelectInstanceDialog::~CSelectInstanceDialog() = default;
{
delete ui;
}
CScriptObject* CSelectInstanceDialog::SelectedInstance() const CScriptObject* CSelectInstanceDialog::SelectedInstance() const
{ {

View File

@ -6,6 +6,8 @@
#include <QDialog> #include <QDialog>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <memory>
namespace Ui { namespace Ui {
class CSelectInstanceDialog; class CSelectInstanceDialog;
} }
@ -20,15 +22,15 @@ class CSelectInstanceDialog : public QDialog
CInstancesProxyModel mLayersProxyModel; CInstancesProxyModel mLayersProxyModel;
CInstancesProxyModel mTypesProxyModel; CInstancesProxyModel mTypesProxyModel;
bool mValidSelection; bool mValidSelection = false;
CScriptObject *mpLayersInst; CScriptObject *mpLayersInst = nullptr;
CScriptObject *mpTypesInst; CScriptObject *mpTypesInst = nullptr;
Ui::CSelectInstanceDialog *ui; std::unique_ptr<Ui::CSelectInstanceDialog> ui;
public: public:
explicit CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pParent = 0); explicit CSelectInstanceDialog(CWorldEditor *pEditor, QWidget *pParent = nullptr);
~CSelectInstanceDialog(); ~CSelectInstanceDialog() override;
CScriptObject* SelectedInstance() const; CScriptObject* SelectedInstance() const;