Maraiah/tycho/cc/mapmodel.cc

66 lines
1.1 KiB
C++
Raw Normal View History

2019-07-02 14:57:10 -07:00
#include "tycho.h"
2019-07-03 17:51:38 -07:00
CMapModel::CMapModel(Project *parent) :
IMapModel(static_cast<QWidget *>(parent)),
IProjectModel()
2019-07-02 14:57:10 -07:00
{
dbgPrintFunc();
}
2019-07-03 17:51:38 -07:00
CMapModel::~CMapModel()
2019-07-02 14:57:10 -07:00
{
dbgPrintFunc();
}
2019-07-03 17:51:38 -07:00
bool CMapModel::isDirty() const
2019-07-02 14:57:10 -07:00
{
2019-07-03 17:51:38 -07:00
return IMapModel::isDirty();
2019-07-02 14:57:10 -07:00
}
2019-07-03 17:51:38 -07:00
bool CMapModel::open(QString const &path)
2019-07-02 14:57:10 -07:00
{
2019-07-03 17:51:38 -07:00
return IMapModel::open(path);
2019-07-02 14:57:10 -07:00
}
2019-07-03 17:51:38 -07:00
bool CMapModel::save() const
2019-07-02 14:57:10 -07:00
{
2019-07-03 17:51:38 -07:00
return IMapModel::save();
2019-07-02 14:57:10 -07:00
}
2019-07-03 17:51:38 -07:00
bool CMapModel::saveAs(QString const &path) const
2019-07-02 14:57:10 -07:00
{
2019-07-03 17:51:38 -07:00
return IMapModel::saveAs(path);
2019-07-02 14:57:10 -07:00
}
2019-07-03 17:51:38 -07:00
void CMapModel::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();
}
2019-07-03 17:51:38 -07:00
void CMapModel::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);
}
2019-07-03 17:51:38 -07:00
QVariant CMapModel::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