andre@88: /* Copyright (C) 2015 by ETH Zürich andre@88: * Software engineering by Intevation GmbH andre@88: * andre@88: * This file is Free Software under the GNU GPL (v>=2) andre@88: * and comes with ABSOLUTELY NO WARRANTY! andre@88: * See LICENSE.txt for details. andre@88: */ andre@88: #include "includeemptysortmodel.h" andre@88: andre@88: bool IncludeEmptySortModel::filterAcceptsRow(int row, const QModelIndex &parent) const andre@88: { andre@88: bool parentAcceptsRow = QSortFilterProxyModel::filterAcceptsRow(row, parent); andre@88: if (!mIncludeEmpty || parentAcceptsRow) { andre@88: return parentAcceptsRow; andre@88: } andre@88: andre@88: QModelIndex source_index = sourceModel()->index(row, filterKeyColumn(), parent); andre@88: if (!source_index.isValid()) // the column may not exist andre@88: return true; andre@88: QString key = sourceModel()->data(source_index).toString(); andre@88: return key.isEmpty(); andre@88: }