3 #include <QAbstractItemModel> 4 #include <QIdentityProxyModel> 7 #include <QPersistentModelIndex> 8 #include <QSortFilterProxyModel> 9 #include <QStandardItem> 17 SortFilterProxyModel::SortFilterProxyModel(
QObject *parent) :
26 selIx.append(item->index() );
30 foreach(QModelIndex ix,selIx) {
31 selectedIndexRows.append(ix.row() );
34 selectedIndices=selIx;
38 void SortFilterProxyModel::setSourceModel(
ProjectItemModel *newSourceModel) {
40 QPersistentModelIndex persistentIndex(newSourceModel->index(0,0,QModelIndex()));
44 if (persistentIndex.isValid()) {
46 m_root = persistentIndex;
50 m_root = QPersistentModelIndex(QModelIndex());
53 baseModel = newSourceModel;
54 QSortFilterProxyModel::setSourceModel(newSourceModel);
58 bool SortFilterProxyModel::setRoot(
const QStandardItem *item) {
60 m_root = QPersistentModelIndex(item->index());
67 bool SortFilterProxyModel::filterAcceptsRow(
int sourceRow,
68 const QModelIndex &sourceParent)
const {
71 if (selectedIndices.count() == 0) {
75 if (this->sourceModel()!=
nullptr) {
76 QModelIndex ix = this->sourceModel()->index( sourceRow, 0, sourceParent );
79 if (selectedIndices.contains(ix) ) {
82 if (item->text() ==
"Images" ) {
ProjectItem * itemFromIndex(const QModelIndex &index)
Returns the ProjectItem corresponding to a given QModelIndex.
Provides access to data stored in a Project through Qt's model-view framework.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Represents an item of a ProjectItemModel in Qt's model-view framework.
Namespace for ISIS/Bullet specific routines.