Maraiah/tycho/cc/mapmodel.cc

45 lines
780 B
C++
Raw Normal View History

2019-07-02 14:57:10 -07:00
#include "tycho.h"
MapModel::MapModel(Project *parent) :
IMapModel(parent)
2019-07-02 14:57:10 -07:00
{
dbgPrintFunc();
}
MapModel::~MapModel()
2019-07-02 14:57:10 -07:00
{
dbgPrintFunc();
}
void MapModel::deselect()
2019-07-03 16:26:28 -07:00
{
2019-07-03 17:51:38 -07:00
IMapModel::deselect();
2019-07-03 16:26:28 -07:00
emit deselected();
}
void MapModel::select(QModelIndex const &index)
2019-07-03 16:26:28 -07:00
{
auto idx = index.internalId();
2019-07-03 17:51:38 -07:00
IMapModel::select(idx);
2019-07-03 16:26:28 -07:00
emit selected(idx);
}
QVariant MapModel::data(const QModelIndex &index, int role) const
2019-07-02 14:57:10 -07:00
{
switch(role) {
case Qt::DecorationRole: {
auto name = propIcon(index.row());
auto icon = name.front() == ':' ? QIcon(name)
: QIcon::fromTheme(name);
2019-07-02 14:57:10 -07:00
return QVariant::fromValue(icon);
}
default:
2019-07-03 17:51:38 -07:00
return IMapModel::data(index, role);
2019-07-02 14:57:10 -07:00
}
}
// EOF