ICS

QicsTable Documentation Set

QicsSorter.h

Go to the documentation of this file.
00001 /*********************************************************************
00002 **
00003 ** Copyright (C) 2002-2006 Integrated Computer Solutions, Inc
00004 ** All rights reserved.
00005 **
00006 ** This file is part of the QicsTable Product.
00007 **
00008 **********************************************************************/
00009 
00010 #ifndef _QICSSORTER_H
00011 #define _QICSSORTER_H
00012 
00013 #include <QObject>
00014 #include <QVector>
00015 
00016 #include <QicsDataModel.h>
00017 #include <QicsDataItem.h>
00018 
00020 
00021 
00035 
00036 
00039 
00040 class QicsSorter: public QObject, public Qics
00041 {
00042     Q_OBJECT
00043 
00044 public:
00045 
00049     QicsSorter(Qics::QicsIndexType _type, QicsDataModel *dm);
00050 
00054     ~QicsSorter();
00055 
00056 
00069     void sort(QVector<int> otherAxisesIndex,
00070           QicsSortOrder order = Qics::Ascending,
00071           int from = 0, int to = -1,
00072           DataItemComparator func = NULL);
00073 
00077     int visualToModel(int x);
00078 
00082     int modelToVisual(int x);
00083 
00090     void moveItems(int target, const QVector<int> &itms);
00091 
00096     void setSortMode(Qics::QicsSortMode mode)
00097      { mySortMode = mode; }
00098 
00103     Qics::QicsSortMode sortMode(void)
00104      { return mySortMode; }
00105 
00106 
00107 protected slots:
00112     void insertElements(int num, int start_position);
00113 
00118     void appendElements(int num);
00119 
00124     void deleteElements(int num, int start_position);
00125 
00126 
00127 
00128 
00129 protected:
00133     void integrityCheck(void);
00134 
00136     Qics::QicsSortMode mySortMode;
00137 
00138 private:
00141     void expandTo(int how_many);
00142 
00144     void fillVisualToModelMap(void);
00145 
00147     void fillModelToVisualMap(void);
00148 
00150     void flushModelToVisualMap(void);
00151 
00154     void installNewOrder(int *neworder, int newlen);
00155 
00156 
00158     //
00159     // Signals
00160     //
00162 
00163 signals:
00164 
00170     void orderChanged(QicsIndexType type, QVector<int> map);
00171 
00172 
00174     //
00175     // Data members
00176     //
00178 
00179 /* private data members */
00180 private:
00181 
00183     Qics::QicsIndexType myType;
00184 
00186     QicsDataModel *myDM;
00187 
00189     QVector<int>    order;
00190 
00192     QVector<int>    modelToVisualMap;
00193 
00194 
00195 public:
00196     friend class QicsSorter_sortHelper;
00197 };
00198 
00199 #endif /* _QICSSORTER_H */

All trademarks and copyrights on this page are properties of their respective owners.
The rest is copyright 1999-2006 Integrated Computer Solutions, Inc.