#include "idtableproxymodel.hpp" #include #include #include "idtable.hpp" bool CSMWorld::IdTableProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex& sourceParent) const { if (!mFilter) return true; std::map otherFilters; /// \todo get other filters; std::map columns; /// \todo get columns return mFilter->test (dynamic_cast (*sourceModel()), sourceRow, otherFilters, columns, mUserValue); } CSMWorld::IdTableProxyModel::IdTableProxyModel (QObject *parent) : QSortFilterProxyModel (parent) {} QModelIndex CSMWorld::IdTableProxyModel::getModelIndex (const std::string& id, int column) const { return mapFromSource (dynamic_cast (*sourceModel()).getModelIndex (id, column)); } void CSMWorld::IdTableProxyModel::setFilter (const boost::shared_ptr& filter, const std::string& userValue) { mFilter = filter; mUserValue = userValue; invalidateFilter(); }