From cfed61c6ffa79a63e18313bd86dfb1cea2f2b6be Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Thu, 28 Nov 2024 12:46:26 -0500 Subject: [PATCH] Added Icon column to location marker manager dialog --- scwx-qt/source/scwx/qt/model/marker_model.cpp | 22 ++++++++++++++++++- scwx-qt/source/scwx/qt/model/marker_model.hpp | 3 ++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/scwx-qt/source/scwx/qt/model/marker_model.cpp b/scwx-qt/source/scwx/qt/model/marker_model.cpp index c035900a..0fc22ab0 100644 --- a/scwx-qt/source/scwx/qt/model/marker_model.cpp +++ b/scwx-qt/source/scwx/qt/model/marker_model.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,6 @@ public: MarkerModel::MarkerModel(QObject* parent) : QAbstractTableModel(parent), p(std::make_unique()) { - connect(p->markerManager_.get(), &manager::MarkerManager::MarkersInitialized, this, @@ -127,6 +127,23 @@ QVariant MarkerModel::data(const QModelIndex& index, int role) const } break; break; + case static_cast(Column::Icon): + if (role == Qt::ItemDataRole::DecorationRole) + { + for (auto& icon : types::getMarkerIcons()) + { + if (icon.name == markerInfo->iconName) + { + return util::modulateColors(icon.qIcon, + QSize(30, 30), + QColor(markerInfo->iconColor[0], + markerInfo->iconColor[1], + markerInfo->iconColor[2], + markerInfo->iconColor[3])); + } + } + } + break; default: break; @@ -164,6 +181,9 @@ QVariant MarkerModel::headerData(int section, case static_cast(Column::Longitude): return tr("Longitude"); + case static_cast(Column::Icon): + return tr("Icon"); + default: break; } diff --git a/scwx-qt/source/scwx/qt/model/marker_model.hpp b/scwx-qt/source/scwx/qt/model/marker_model.hpp index 4fc6c95c..91c8854f 100644 --- a/scwx-qt/source/scwx/qt/model/marker_model.hpp +++ b/scwx-qt/source/scwx/qt/model/marker_model.hpp @@ -17,7 +17,8 @@ public: { Latitude = 0, Longitude = 1, - Name = 2, + Icon = 2, + Name = 3, }; explicit MarkerModel(QObject* parent = nullptr);