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