diff --git a/src/Editor/WorldEditor/CPoiMapSidebar.cpp b/src/Editor/WorldEditor/CPoiMapSidebar.cpp index 5aff53bd..9eae99ac 100644 --- a/src/Editor/WorldEditor/CPoiMapSidebar.cpp +++ b/src/Editor/WorldEditor/CPoiMapSidebar.cpp @@ -12,17 +12,14 @@ #include #include -const CColor CPoiMapSidebar::skNormalColor(0.137255f, 0.184314f, 0.776471f, 0.5f); -const CColor CPoiMapSidebar::skImportantColor(0.721569f, 0.066667f, 0.066667f, 0.5f); -const CColor CPoiMapSidebar::skHoverColor(0.047059f, 0.2f, 0.003922f, 0.5f); +constexpr CColor skNormalColor(0.137255f, 0.184314f, 0.776471f, 0.5f); +constexpr CColor skImportantColor(0.721569f, 0.066667f, 0.066667f, 0.5f); +constexpr CColor skHoverColor(0.047059f, 0.2f, 0.003922f, 0.5f); CPoiMapSidebar::CPoiMapSidebar(CWorldEditor *pEditor) : CWorldEditorSidebar(pEditor) - , ui(new Ui::CPoiMapSidebar) + , ui(std::make_unique()) , mSourceModel(pEditor, this) - , mHighlightMode(EHighlightMode::HighlightSelected) - , mPickType(EPickType::NotPicking) - , mpHoverModel(nullptr) { mModel.setSourceModel(&mSourceModel); mModel.sort(0); @@ -46,10 +43,7 @@ CPoiMapSidebar::CPoiMapSidebar(CWorldEditor *pEditor) connect(ui->RemovePoiButton, SIGNAL(clicked()), this, SLOT(OnRemovePoiButtonClicked())); } -CPoiMapSidebar::~CPoiMapSidebar() -{ - delete ui; -} +CPoiMapSidebar::~CPoiMapSidebar() = default; void CPoiMapSidebar::SidebarOpen() { diff --git a/src/Editor/WorldEditor/CPoiMapSidebar.h b/src/Editor/WorldEditor/CPoiMapSidebar.h index f805b487..94d0a1f6 100644 --- a/src/Editor/WorldEditor/CPoiMapSidebar.h +++ b/src/Editor/WorldEditor/CPoiMapSidebar.h @@ -9,6 +9,8 @@ #include #include +#include + namespace Ui { class CPoiMapSidebar; } @@ -16,7 +18,7 @@ class CPoiMapSidebar; class CPoiMapSidebar : public CWorldEditorSidebar { Q_OBJECT - Ui::CPoiMapSidebar *ui; + std::unique_ptr ui; public: enum class EHighlightMode @@ -38,20 +40,17 @@ public: private: CPoiMapModel mSourceModel; QSortFilterProxyModel mModel; - EHighlightMode mHighlightMode; + EHighlightMode mHighlightMode{EHighlightMode::HighlightSelected}; - EPickType mPickType; - CModelNode *mpHoverModel; - - static const CColor skNormalColor; - static const CColor skImportantColor; - static const CColor skHoverColor; + EPickType mPickType{EPickType::NotPicking}; + CModelNode *mpHoverModel = nullptr; public: explicit CPoiMapSidebar(CWorldEditor *pEditor); - ~CPoiMapSidebar(); - void SidebarOpen(); - void SidebarClose(); + ~CPoiMapSidebar() override; + + void SidebarOpen() override; + void SidebarClose() override; void HighlightPoiModels(const QModelIndex& rkIndex); void UnhighlightPoiModels(const QModelIndex& rkIndex); void HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode);