mysortfilterproxymodel.cpp
changeset 804 14f2b1b15242
parent 802 f076fdec767d
child 813 82ebfc46233b
     1.1 --- a/mysortfilterproxymodel.cpp	Fri Oct 02 14:31:03 2009 +0000
     1.2 +++ b/mysortfilterproxymodel.cpp	Fri Nov 13 08:32:03 2009 +0000
     1.3 @@ -1,55 +1,14 @@
     1.4 -/****************************************************************************
     1.5 -**
     1.6 -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.7 -** Contact: Nokia Corporation (qt-info@nokia.com)
     1.8 -**
     1.9 -** This file is part of the examples of the Qt Toolkit.
    1.10 -**
    1.11 -** $QT_BEGIN_LICENSE:LGPL$
    1.12 -** Commercial Usage
    1.13 -** Licensees holding valid Qt Commercial licenses may use this file in
    1.14 -** accordance with the Qt Commercial License Agreement provided with the
    1.15 -** Software or, alternatively, in accordance with the terms contained in
    1.16 -** a written agreement between you and Nokia.
    1.17 -**
    1.18 -** GNU Lesser General Public License Usage
    1.19 -** Alternatively, this file may be used under the terms of the GNU Lesser
    1.20 -** General Public License version 2.1 as published by the Free Software
    1.21 -** Foundation and appearing in the file LICENSE.LGPL included in the
    1.22 -** packaging of this file.  Please review the following information to
    1.23 -** ensure the GNU Lesser General Public License version 2.1 requirements
    1.24 -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    1.25 -**
    1.26 -** In addition, as a special exception, Nokia gives you certain
    1.27 -** additional rights. These rights are described in the Nokia Qt LGPL
    1.28 -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    1.29 -** package.
    1.30 -**
    1.31 -** GNU General Public License Usage
    1.32 -** Alternatively, this file may be used under the terms of the GNU
    1.33 -** General Public License version 3.0 as published by the Free Software
    1.34 -** Foundation and appearing in the file LICENSE.GPL included in the
    1.35 -** packaging of this file.  Please review the following information to
    1.36 -** ensure the GNU General Public License version 3.0 requirements will be
    1.37 -** met: http://www.gnu.org/copyleft/gpl.html.
    1.38 -**
    1.39 -** If you are unsure which license is appropriate for your use, please
    1.40 -** contact the sales department at http://www.qtsoftware.com/contact.
    1.41 -** $QT_END_LICENSE$
    1.42 -**
    1.43 -****************************************************************************/
    1.44 -
    1.45 -#include <QtGui>
    1.46 +//#include <QtGui>
    1.47  
    1.48  #include "mysortfilterproxymodel.h"
    1.49  
    1.50 -//! [0]
    1.51  MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
    1.52      : QSortFilterProxyModel(parent)
    1.53  {
    1.54  }
    1.55  //! [0]
    1.56  
    1.57 +/*
    1.58  //! [1]
    1.59  void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
    1.60  {
    1.61 @@ -64,10 +23,9 @@
    1.62      maxDate = date;
    1.63      invalidateFilter();
    1.64  }
    1.65 -//! [2]
    1.66 +*/
    1.67  
    1.68 -//! [3]
    1.69 -bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,
    1.70 +bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,	// FIXME-1 find a way to show _all_ rows which match, independent of parent
    1.71          const QModelIndex &sourceParent) const
    1.72  {
    1.73      QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
    1.74 @@ -75,12 +33,11 @@
    1.75      QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
    1.76  
    1.77      return (sourceModel()->data(index0).toString().contains(filterRegExp())
    1.78 -            || sourceModel()->data(index1).toString().contains(filterRegExp()))
    1.79 -           && dateInRange(sourceModel()->data(index2).toDate());
    1.80 +            || sourceModel()->data(index1).toString().contains(filterRegExp()));
    1.81 +//           && dateInRange(sourceModel()->data(index2).toDate());
    1.82  }
    1.83 -//! [3]
    1.84  
    1.85 -//! [4] //! [5]
    1.86 +/*
    1.87  bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
    1.88                                        const QModelIndex &right) const
    1.89  {
    1.90 @@ -114,3 +71,4 @@
    1.91             && (!maxDate.isValid() || date < maxDate);
    1.92  }
    1.93  //! [7]
    1.94 +*/