Mercurial > retraceit
view src/includeemptysortmodel.h @ 88:3916cb3c9105
Add new FilterSort model that allows to include empty values
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 19 Jun 2015 14:26:16 +0200 |
parents | |
children | 07e1e47954f6 |
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(false) {} /** @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