CPoiMapSidebar: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 04:34:12 -04:00
parent 9a157ed58d
commit 49c5947731
2 changed files with 15 additions and 22 deletions

View File

@ -12,17 +12,14 @@
#include <QMouseEvent>
#include <QMessageBox>
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<Ui::CPoiMapSidebar>())
, 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()
{

View File

@ -9,6 +9,8 @@
#include <QMainWindow>
#include <QSortFilterProxyModel>
#include <memory>
namespace Ui {
class CPoiMapSidebar;
}
@ -16,7 +18,7 @@ class CPoiMapSidebar;
class CPoiMapSidebar : public CWorldEditorSidebar
{
Q_OBJECT
Ui::CPoiMapSidebar *ui;
std::unique_ptr<Ui::CPoiMapSidebar> 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);