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

View File

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