Warning, file /office/calligra/braindump/src/TreeSortFilter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 Copyright (c) 2006 Frans Englich <frans.englich@telia.com> 0003 0004 This file is part of the KDE project 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Library General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or(at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Library General Public License for more details. 0015 0016 You should have received a copy of the GNU Library General Public License 0017 along with this library; see the file COPYING.LIB. If not, write to 0018 the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 0019 Boston, MA 02110-1301, USA. 0020 */ 0021 0022 0023 #ifndef KXQTS_TreeSortFilter_H 0024 #define KXQTS_TreeSortFilter_H 0025 0026 #include <QSortFilterProxyModel> 0027 0028 /** 0029 * @short A sort & filter model for hierarchical item models. 0030 * 0031 * The current feature is that, when sorting, numbers are treated as 0032 * a whole instead of on a character-per-character basis. For example, "myFile-10" is sorted 0033 * after "myFile-9". 0034 * 0035 * @ingroup KXQTS 0036 * @author Frans Englich <frans.englich@telia.com> 0037 */ 0038 class TreeSortFilter : public QSortFilterProxyModel 0039 { 0040 public: 0041 /** 0042 * Creates a TreeSortFilter. 0043 * 0044 * @param parent the parent. Must not be @c null. 0045 */ 0046 explicit TreeSortFilter(QObject *parent); 0047 protected: 0048 0049 /** 0050 * Compares @p left and @p right. They are treated as QStrings. 0051 */ 0052 virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; 0053 0054 virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; 0055 0056 private: 0057 inline bool numericLessThan(const QString &l, const QString &r) const; 0058 }; 0059 0060 #endif