insilmaril@795
|
1 |
/****************************************************************************
|
insilmaril@795
|
2 |
**
|
insilmaril@795
|
3 |
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
insilmaril@795
|
4 |
** Contact: Qt Software Information (qt-info@nokia.com)
|
insilmaril@795
|
5 |
**
|
insilmaril@795
|
6 |
** This file is part of the example classes of the Qt Toolkit.
|
insilmaril@795
|
7 |
**
|
insilmaril@795
|
8 |
** Commercial Usage
|
insilmaril@795
|
9 |
** Licensees holding valid Qt Commercial licenses may use this file in
|
insilmaril@795
|
10 |
** accordance with the Qt Commercial License Agreement provided with the
|
insilmaril@795
|
11 |
** Software or, alternatively, in accordance with the terms contained in
|
insilmaril@795
|
12 |
** a written agreement between you and Nokia.
|
insilmaril@795
|
13 |
**
|
insilmaril@795
|
14 |
**
|
insilmaril@795
|
15 |
** GNU General Public License Usage
|
insilmaril@795
|
16 |
** Alternatively, this file may be used under the terms of the GNU
|
insilmaril@795
|
17 |
** General Public License versions 2.0 or 3.0 as published by the Free
|
insilmaril@795
|
18 |
** Software Foundation and appearing in the file LICENSE.GPL included in
|
insilmaril@795
|
19 |
** the packaging of this file. Please review the following information
|
insilmaril@795
|
20 |
** to ensure GNU General Public Licensing requirements will be met:
|
insilmaril@795
|
21 |
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
insilmaril@795
|
22 |
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
|
insilmaril@795
|
23 |
** exception, Nokia gives you certain additional rights. These rights
|
insilmaril@795
|
24 |
** are described in the Nokia Qt GPL Exception version 1.3, included in
|
insilmaril@795
|
25 |
** the file GPL_EXCEPTION.txt in this package.
|
insilmaril@795
|
26 |
**
|
insilmaril@795
|
27 |
** Qt for Windows(R) Licensees
|
insilmaril@795
|
28 |
** As a special exception, Nokia, as the sole copyright holder for Qt
|
insilmaril@795
|
29 |
** Designer, grants users of the Qt/Eclipse Integration plug-in the
|
insilmaril@795
|
30 |
** right for the Qt/Eclipse Integration to link to functionality
|
insilmaril@795
|
31 |
** provided by Qt Designer and its related libraries.
|
insilmaril@795
|
32 |
**
|
insilmaril@795
|
33 |
** If you are unsure which license is appropriate for your use, please
|
insilmaril@795
|
34 |
** contact the sales department at qt-sales@nokia.com.
|
insilmaril@795
|
35 |
**
|
insilmaril@795
|
36 |
****************************************************************************/
|
insilmaril@795
|
37 |
|
insilmaril@795
|
38 |
#ifndef MYSORTFILTERPROXYMODEL_H
|
insilmaril@795
|
39 |
#define MYSORTFILTERPROXYMODEL_H
|
insilmaril@795
|
40 |
|
insilmaril@795
|
41 |
#include <QDate>
|
insilmaril@795
|
42 |
#include <QSortFilterProxyModel>
|
insilmaril@795
|
43 |
|
insilmaril@795
|
44 |
//! [0]
|
insilmaril@795
|
45 |
class MySortFilterProxyModel : public QSortFilterProxyModel
|
insilmaril@795
|
46 |
{
|
insilmaril@795
|
47 |
Q_OBJECT
|
insilmaril@795
|
48 |
|
insilmaril@795
|
49 |
public:
|
insilmaril@795
|
50 |
MySortFilterProxyModel(QObject *parent = 0);
|
insilmaril@795
|
51 |
|
insilmaril@795
|
52 |
// QDate filterMinimumDate() const { return minDate; }
|
insilmaril@795
|
53 |
// void setFilterMinimumDate(const QDate &date);
|
insilmaril@795
|
54 |
|
insilmaril@795
|
55 |
// QDate filterMaximumDate() const { return maxDate; }
|
insilmaril@795
|
56 |
// void setFilterMaximumDate(const QDate &date);
|
insilmaril@795
|
57 |
|
insilmaril@795
|
58 |
protected:
|
insilmaril@795
|
59 |
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
|
insilmaril@795
|
60 |
// bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
insilmaril@795
|
61 |
|
insilmaril@795
|
62 |
private:
|
insilmaril@795
|
63 |
bool dateInRange(const QDate &date) const;
|
insilmaril@795
|
64 |
|
insilmaril@795
|
65 |
QDate minDate;
|
insilmaril@795
|
66 |
QDate maxDate;
|
insilmaril@795
|
67 |
};
|
insilmaril@795
|
68 |
//! [0]
|
insilmaril@795
|
69 |
|
insilmaril@795
|
70 |
#endif
|