forked from teamnwah/openmw-tes3coop
Removed checkboxes from master list
Moved checkbox code from datafilesmodel to pluginsproxymodel
This commit is contained in:
parent
61602789e1
commit
0087b0d67c
3 changed files with 20 additions and 8 deletions
|
@ -117,11 +117,6 @@ QVariant DataFilesModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::CheckStateRole: {
|
|
||||||
if (column != 0)
|
|
||||||
return QVariant();
|
|
||||||
return mCheckStates[file->fileName()];
|
|
||||||
}
|
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
{
|
{
|
||||||
if (column != 0)
|
if (column != 0)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include "pluginsproxymodel.hpp"
|
#include "pluginsproxymodel.hpp"
|
||||||
|
#include "datafilesmodel.hpp"
|
||||||
|
|
||||||
PluginsProxyModel::PluginsProxyModel(QObject *parent, QAbstractTableModel *model) :
|
PluginsProxyModel::PluginsProxyModel(QObject *parent, DataFilesModel *model) :
|
||||||
QSortFilterProxyModel(parent)
|
QSortFilterProxyModel(parent), mSourceModel (model)
|
||||||
{
|
{
|
||||||
setFilterRegExp(QString("addon"));
|
setFilterRegExp(QString("addon"));
|
||||||
setFilterRole (Qt::UserRole);
|
setFilterRole (Qt::UserRole);
|
||||||
|
@ -16,5 +17,16 @@ PluginsProxyModel::~PluginsProxyModel()
|
||||||
|
|
||||||
QVariant PluginsProxyModel::data(const QModelIndex &index, int role) const
|
QVariant PluginsProxyModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
|
switch (role)
|
||||||
|
{
|
||||||
|
case Qt::CheckStateRole:
|
||||||
|
{
|
||||||
|
if (index.column() != 0)
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
return mSourceModel->checkState(index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return QSortFilterProxyModel::data (index, role);
|
return QSortFilterProxyModel::data (index, role);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,17 @@
|
||||||
|
|
||||||
class QVariant;
|
class QVariant;
|
||||||
class QAbstractTableModel;
|
class QAbstractTableModel;
|
||||||
|
class DataFilesModel;
|
||||||
|
|
||||||
class PluginsProxyModel : public QSortFilterProxyModel
|
class PluginsProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
DataFilesModel *mSourceModel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PluginsProxyModel(QObject *parent = 0, QAbstractTableModel *model = 0);
|
|
||||||
|
explicit PluginsProxyModel(QObject *parent = 0, DataFilesModel *model = 0);
|
||||||
~PluginsProxyModel();
|
~PluginsProxyModel();
|
||||||
|
|
||||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
Loading…
Reference in a new issue