mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 13:30:06 +00:00
Add custom marker icons, and rework how marker icons are handled.
This commit is contained in:
parent
3685599693
commit
5bb4a7f95a
10 changed files with 368 additions and 204 deletions
|
|
@ -19,6 +19,7 @@ namespace model
|
|||
|
||||
static const std::string logPrefix_ = "scwx::qt::model::marker_model";
|
||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||
static const int iconSize_ = 30;
|
||||
|
||||
static constexpr int kFirstColumn =
|
||||
static_cast<int>(MarkerModel::Column::Latitude);
|
||||
|
|
@ -130,17 +131,19 @@ QVariant MarkerModel::data(const QModelIndex& index, int role) const
|
|||
case static_cast<int>(Column::Icon):
|
||||
if (role == Qt::ItemDataRole::DecorationRole)
|
||||
{
|
||||
for (auto& icon : types::getMarkerIcons())
|
||||
std::optional<types::MarkerIconInfo> icon =
|
||||
p->markerManager_->get_icon(markerInfo->iconName);
|
||||
if (icon) {
|
||||
return util::modulateColors(icon->qIcon,
|
||||
QSize(iconSize_, iconSize_),
|
||||
QColor(markerInfo->iconColor[0],
|
||||
markerInfo->iconColor[1],
|
||||
markerInfo->iconColor[2],
|
||||
markerInfo->iconColor[3]));
|
||||
}
|
||||
else
|
||||
{
|
||||
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]));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue