openmw-tes3coop/components/esxselector/model/pluginsproxymodel.cpp

34 lines
766 B
C++
Raw Normal View History

#include "pluginsproxymodel.hpp"
#include "datafilesmodel.hpp"
PluginsProxyModel::PluginsProxyModel(QObject *parent, DataFilesModel *model) :
QSortFilterProxyModel(parent)
{
setFilterRegExp (QString("addon"));
setFilterRole (Qt::UserRole);
setDynamicSortFilter (true);
if (model)
setSourceModel (model);
}
PluginsProxyModel::~PluginsProxyModel()
{
}
2013-08-17 02:12:30 +00:00
QVariant PluginsProxyModel::data(const QModelIndex &index, int role) const
{
switch (role)
{
case Qt::CheckStateRole:
{
if (index.column() != 0)
return QVariant();
return static_cast<DataFilesModel *>(sourceModel())->checkState(mapToSource(index));
}
};
2013-08-17 02:12:30 +00:00
return QSortFilterProxyModel::data (index, role);
}