KDEUI
kcategorizedsortfilterproxymodel.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE project 00003 * Copyright (C) 2007 Rafael Fernández López <ereslibre@kde.org> 00004 * Copyright (C) 2007 John Tapsell <tapsell@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KCATEGORIZEDSORTFILTERPROXYMODEL_H 00023 #define KCATEGORIZEDSORTFILTERPROXYMODEL_H 00024 00025 #include <QtGui/QSortFilterProxyModel> 00026 00027 #include <kdeui_export.h> 00028 00029 class QItemSelection; 00030 00031 00045 class KDEUI_EXPORT KCategorizedSortFilterProxyModel 00046 : public QSortFilterProxyModel 00047 { 00048 public: 00049 enum AdditionalRoles { 00050 // Note: use printf "0x%08X\n" $(($RANDOM*$RANDOM)) 00051 // to define additional roles. 00052 CategoryDisplayRole = 0x17CE990A, 00053 00054 CategorySortRole = 0x27857E60 00055 00056 00057 00058 00059 00060 }; 00061 00062 KCategorizedSortFilterProxyModel(QObject *parent = 0); 00063 virtual ~KCategorizedSortFilterProxyModel(); 00064 00069 virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); 00070 00074 bool isCategorizedModel() const; 00075 00081 void setCategorizedModel(bool categorizedModel); 00082 00086 int sortColumn() const; 00087 00091 Qt::SortOrder sortOrder() const; 00092 00100 void setSortCategoriesByNaturalComparison(bool sortCategoriesByNaturalComparison); 00101 00105 bool sortCategoriesByNaturalComparison() const; 00106 00114 #ifndef KDE_NO_DEPRECATED 00115 KDE_DEPRECATED static int naturalCompare(const QString &a, const QString &b); 00116 #endif 00117 00118 protected: 00132 virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; 00133 00140 virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const; 00141 00177 virtual int compareCategories(const QModelIndex &left, const QModelIndex &right) const; 00178 00179 private: 00180 class Private; 00181 Private *const d; 00182 }; 00183 00184 00185 #endif // KCATEGORIZEDSORTFILTERPROXYMODEL_H
KDE 4.6 API Reference