insilmaril@795: /**************************************************************************** insilmaril@795: ** insilmaril@802: ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). insilmaril@802: ** Contact: Nokia Corporation (qt-info@nokia.com) insilmaril@795: ** insilmaril@802: ** This file is part of the examples of the Qt Toolkit. insilmaril@795: ** insilmaril@802: ** $QT_BEGIN_LICENSE:LGPL$ insilmaril@795: ** Commercial Usage insilmaril@795: ** Licensees holding valid Qt Commercial licenses may use this file in insilmaril@795: ** accordance with the Qt Commercial License Agreement provided with the insilmaril@795: ** Software or, alternatively, in accordance with the terms contained in insilmaril@795: ** a written agreement between you and Nokia. insilmaril@795: ** insilmaril@802: ** GNU Lesser General Public License Usage insilmaril@802: ** Alternatively, this file may be used under the terms of the GNU Lesser insilmaril@802: ** General Public License version 2.1 as published by the Free Software insilmaril@802: ** Foundation and appearing in the file LICENSE.LGPL included in the insilmaril@802: ** packaging of this file. Please review the following information to insilmaril@802: ** ensure the GNU Lesser General Public License version 2.1 requirements insilmaril@802: ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. insilmaril@802: ** insilmaril@802: ** In addition, as a special exception, Nokia gives you certain insilmaril@802: ** additional rights. These rights are described in the Nokia Qt LGPL insilmaril@802: ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this insilmaril@802: ** package. insilmaril@795: ** insilmaril@795: ** GNU General Public License Usage insilmaril@795: ** Alternatively, this file may be used under the terms of the GNU insilmaril@802: ** General Public License version 3.0 as published by the Free Software insilmaril@802: ** Foundation and appearing in the file LICENSE.GPL included in the insilmaril@802: ** packaging of this file. Please review the following information to insilmaril@802: ** ensure the GNU General Public License version 3.0 requirements will be insilmaril@802: ** met: http://www.gnu.org/copyleft/gpl.html. insilmaril@795: ** insilmaril@795: ** If you are unsure which license is appropriate for your use, please insilmaril@802: ** contact the sales department at http://www.qtsoftware.com/contact. insilmaril@802: ** $QT_END_LICENSE$ insilmaril@795: ** insilmaril@795: ****************************************************************************/ insilmaril@795: insilmaril@795: #ifndef MYSORTFILTERPROXYMODEL_H insilmaril@795: #define MYSORTFILTERPROXYMODEL_H insilmaril@795: insilmaril@795: #include insilmaril@795: #include insilmaril@795: insilmaril@795: //! [0] insilmaril@795: class MySortFilterProxyModel : public QSortFilterProxyModel insilmaril@795: { insilmaril@795: Q_OBJECT insilmaril@795: insilmaril@795: public: insilmaril@795: MySortFilterProxyModel(QObject *parent = 0); insilmaril@795: insilmaril@802: QDate filterMinimumDate() const { return minDate; } insilmaril@802: void setFilterMinimumDate(const QDate &date); insilmaril@795: insilmaril@802: QDate filterMaximumDate() const { return maxDate; } insilmaril@802: void setFilterMaximumDate(const QDate &date); insilmaril@795: insilmaril@795: protected: insilmaril@795: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; insilmaril@802: bool lessThan(const QModelIndex &left, const QModelIndex &right) const; insilmaril@795: insilmaril@795: private: insilmaril@795: bool dateInRange(const QDate &date) const; insilmaril@795: insilmaril@795: QDate minDate; insilmaril@795: QDate maxDate; insilmaril@795: }; insilmaril@795: //! [0] insilmaril@795: insilmaril@795: #endif