Maraiah/tycho/cc/mapmodel.cc

66 lines
1.1 KiB
C++

#include "tycho.h"
CMapModel::CMapModel(Project *parent) :
IMapModel(static_cast<QWidget *>(parent)),
IProjectModel()
{
dbgPrintFunc();
}
CMapModel::~CMapModel()
{
dbgPrintFunc();
}
bool CMapModel::isDirty() const
{
return IMapModel::isDirty();
}
bool CMapModel::open(QString const &path)
{
return IMapModel::open(path);
}
bool CMapModel::save() const
{
return IMapModel::save();
}
bool CMapModel::saveAs(QString const &path) const
{
return IMapModel::saveAs(path);
}
void CMapModel::deselect()
{
IMapModel::deselect();
emit deselected();
}
void CMapModel::select(QModelIndex const &index)
{
auto idx = index.internalId();
IMapModel::select(idx);
emit selected(idx);
}
QVariant CMapModel::data(const QModelIndex &index, int role) const
{
switch(role) {
case Qt::DecorationRole: {
auto name = propIcon(index.row());
auto icon = name.front() == ':' ? QIcon(name)
: QIcon::fromTheme(name);
return QVariant::fromValue(icon);
}
default:
return IMapModel::data(index, role);
}
}
// EOF