view src/includeemptysortmodel.h @ 96:a9e72af2e6fa 1.2

(Auto) Update translations
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 29 Jun 2015 15:40:19 +0200
parents 07e1e47954f6
children
line wrap: on
line source
#ifndef INCLUDEEMPTYSORTMODEL_H
#define INCLUDEEMPTYSORTMODEL_H
/* 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.
 */

/**
 * @file  metadataview.h
 * @brief Table view of the meta data information
 */
/**
 * @class IncludeEmptySortModel
 * @brief Small wrapper around sort filter model to allow custom filtering
 */
#include <QModelIndex>
#include <QSortFilterProxyModel>

class IncludeEmptySortModel : public QSortFilterProxyModel
{
    Q_OBJECT

public:
    IncludeEmptySortModel() : QSortFilterProxyModel(), mIncludeEmpty(true) {}

    /** @brief wrapper around the base class call that accepts empty
     * values if includeEmpty is checked. */
    bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;

public slots:
    void setIncludeEmpty(int state) {
        mIncludeEmpty = state != Qt::Unchecked;
        invalidate();
    }

private:
    bool mIncludeEmpty;
};
#endif // INCLUDEEMPTYSORTMODEL_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)