mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
34 lines
766 B
C++
34 lines
766 B
C++
#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()
|
|
{
|
|
}
|
|
|
|
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));
|
|
}
|
|
};
|
|
|
|
return QSortFilterProxyModel::data (index, role);
|
|
}
|