2013-02-19 14:58:01 +00:00
|
|
|
#include "pluginsproxymodel.hpp"
|
2013-08-17 10:37:23 +00:00
|
|
|
#include "datafilesmodel.hpp"
|
2013-02-19 14:58:01 +00:00
|
|
|
|
2013-08-17 10:37:23 +00:00
|
|
|
PluginsProxyModel::PluginsProxyModel(QObject *parent, DataFilesModel *model) :
|
|
|
|
QSortFilterProxyModel(parent), mSourceModel (model)
|
2013-02-19 14:58:01 +00:00
|
|
|
{
|
2013-08-17 02:20:48 +00:00
|
|
|
setFilterRegExp(QString("addon"));
|
|
|
|
setFilterRole (Qt::UserRole);
|
|
|
|
|
|
|
|
if (model)
|
|
|
|
setSourceModel (model);
|
2013-02-19 14:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PluginsProxyModel::~PluginsProxyModel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-08-17 02:12:30 +00:00
|
|
|
QVariant PluginsProxyModel::data(const QModelIndex &index, int role) const
|
2013-02-19 14:58:01 +00:00
|
|
|
{
|
2013-08-17 10:37:23 +00:00
|
|
|
switch (role)
|
|
|
|
{
|
|
|
|
case Qt::CheckStateRole:
|
|
|
|
{
|
|
|
|
if (index.column() != 0)
|
|
|
|
return QVariant();
|
|
|
|
|
|
|
|
return mSourceModel->checkState(index);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-08-17 02:12:30 +00:00
|
|
|
return QSortFilterProxyModel::data (index, role);
|
2013-02-19 14:58:01 +00:00
|
|
|
}
|