andre@88: #ifndef INCLUDEEMPTYSORTMODEL_H andre@88: #define INCLUDEEMPTYSORTMODEL_H 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: andre@88: /** andre@88: * @file metadataview.h andre@88: * @brief Table view of the meta data information andre@88: */ andre@88: /** andre@88: * @class IncludeEmptySortModel andre@88: * @brief Small wrapper around sort filter model to allow custom filtering andre@88: */ andre@88: #include andre@88: #include andre@88: andre@88: class IncludeEmptySortModel : public QSortFilterProxyModel andre@88: { andre@88: Q_OBJECT andre@88: andre@88: public: andre@94: IncludeEmptySortModel() : QSortFilterProxyModel(), mIncludeEmpty(true) {} andre@88: andre@88: /** @brief wrapper around the base class call that accepts empty andre@88: * values if includeEmpty is checked. */ andre@88: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; andre@88: andre@88: public slots: andre@88: void setIncludeEmpty(int state) { andre@88: mIncludeEmpty = state != Qt::Unchecked; andre@88: invalidate(); andre@88: } andre@88: andre@88: private: andre@88: bool mIncludeEmpty; andre@88: }; andre@88: #endif // INCLUDEEMPTYSORTMODEL_H