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

45 lines
1.1 KiB
C++
Raw Normal View History

2013-08-17 02:12:30 +00:00
#include "masterproxymodel.hpp"
2013-09-07 20:57:40 +00:00
#include <QMimeData>
#include <QDebug>
2013-08-17 02:12:30 +00:00
EsxModel::MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTableModel* model) :
2013-08-17 02:12:30 +00:00
QSortFilterProxyModel(parent)
{
setFilterRegExp(QString("game"));
setFilterRole (Qt::UserRole);
if (model)
2013-09-07 20:57:40 +00:00
setSourceModel (model);
//connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(slotSourceModelChanged(QModelIndex, QModelIndex)));
2013-08-17 02:12:30 +00:00
}
2013-09-07 20:57:40 +00:00
/*
QVariant EsxModel::MasterProxyModel::data(const QModelIndex &index, int role) const
2013-08-17 02:12:30 +00:00
{
2013-09-07 20:57:40 +00:00
if (index.isValid())
return QSortFilterProxyModel::data (index, role);
return 0;
}
*/
void EsxModel::MasterProxyModel::slotSourceModelChanged(QModelIndex topLeft, QModelIndex botRight)
{
qDebug() << "source data changed.. updating master proxy";
emit dataChanged(index(0,0), index(rowCount()-1,0));
int curRow = -1;
/*
for (int i = 0; i < rowCount() - 1; ++i)
{
if (index(i,0).data(Qt::CheckState) == Qt::Checked)
{
curRow = i;
break;
}
}
reset();
*/
if (curRow != -1);
// index(curRow, 0).setDataQt::CheckState)
2013-08-17 02:12:30 +00:00
}