view src/includeemptysortmodel.cpp @ 97:4c97abde1c3e

Added tag 1.2 for changeset a9e72af2e6fa
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 29 Jun 2015 15:41:00 +0200
parents 3916cb3c9105
children
line wrap: on
line source
/* Copyright (C) 2015 by ETH Zürich
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */
#include "includeemptysortmodel.h"

bool IncludeEmptySortModel::filterAcceptsRow(int row, const QModelIndex &parent) const
{
    bool parentAcceptsRow = QSortFilterProxyModel::filterAcceptsRow(row, parent);
    if (!mIncludeEmpty || parentAcceptsRow) {
        return parentAcceptsRow;
    }

    QModelIndex source_index = sourceModel()->index(row, filterKeyColumn(), parent);
    if (!source_index.isValid()) // the column may not exist
        return true;
    QString key = sourceModel()->data(source_index).toString();
    return key.isEmpty();
}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)