WModifyTab: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 07:04:04 -04:00
parent fcf40ec18c
commit 34da43e7d4
2 changed files with 13 additions and 14 deletions

View File

@ -12,8 +12,7 @@
WModifyTab::WModifyTab(CWorldEditor *pEditor, QWidget *pParent) WModifyTab::WModifyTab(CWorldEditor *pEditor, QWidget *pParent)
: QWidget(pParent) : QWidget(pParent)
, ui(new Ui::WModifyTab) , ui(std::make_unique<Ui::WModifyTab>())
, mIsPicking(false)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->PropertyView->SetEditor(pEditor); ui->PropertyView->SetEditor(pEditor);
@ -25,8 +24,8 @@ WModifyTab::WModifyTab(CWorldEditor *pEditor, QWidget *pParent)
mpOutLinkModel = new CLinkModel(this); mpOutLinkModel = new CLinkModel(this);
mpOutLinkModel->SetConnectionType(ELinkType::Outgoing); mpOutLinkModel->SetConnectionType(ELinkType::Outgoing);
mpAddFromViewportAction = new QAction("Choose from viewport", this); mpAddFromViewportAction = new QAction(tr("Choose from viewport"), this);
mpAddFromListAction = new QAction("Choose from list", this); mpAddFromListAction = new QAction(tr("Choose from list"), this);
mpAddLinkMenu = new QMenu(this); mpAddLinkMenu = new QMenu(this);
mpAddLinkMenu->addAction(mpAddFromViewportAction); mpAddLinkMenu->addAction(mpAddFromViewportAction);
mpAddLinkMenu->addAction(mpAddFromListAction); mpAddLinkMenu->addAction(mpAddFromListAction);
@ -54,10 +53,7 @@ WModifyTab::WModifyTab(CWorldEditor *pEditor, QWidget *pParent)
ClearUI(); ClearUI();
} }
WModifyTab::~WModifyTab() WModifyTab::~WModifyTab() = default;
{
delete ui;
}
void WModifyTab::ClearUI() void WModifyTab::ClearUI()
{ {

View File

@ -12,6 +12,8 @@
#include <QMenu> #include <QMenu>
#include <QWidget> #include <QWidget>
#include <memory>
class CWorldEditor; class CWorldEditor;
namespace Ui { namespace Ui {
@ -32,11 +34,12 @@ class WModifyTab : public QWidget
QAction *mpAddFromViewportAction; QAction *mpAddFromViewportAction;
QAction *mpAddFromListAction; QAction *mpAddFromListAction;
ELinkType mAddLinkType; ELinkType mAddLinkType;
bool mIsPicking; bool mIsPicking = false;
public: public:
explicit WModifyTab(CWorldEditor *pEditor, QWidget *pParent = 0); explicit WModifyTab(CWorldEditor *pEditor, QWidget *pParent = nullptr);
~WModifyTab(); ~WModifyTab() override;
void ClearUI(); void ClearUI();
CPropertyView* PropertyView() const; CPropertyView* PropertyView() const;
@ -53,11 +56,11 @@ public slots:
void OnDeleteLinksClicked(); void OnDeleteLinksClicked();
void OnEditLinkClicked(); void OnEditLinkClicked();
inline bool IsPicking() const { return mIsPicking; } bool IsPicking() const { return mIsPicking; }
inline CSceneNode* EditNode() const { return mpSelectedNode; } CSceneNode* EditNode() const { return mpSelectedNode; }
private: private:
Ui::WModifyTab *ui; std::unique_ptr<Ui::WModifyTab> ui;
private slots: private slots:
void OnLinkTableDoubleClick(QModelIndex Index); void OnLinkTableDoubleClick(QModelIndex Index);