numberlistmodel.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef NUMBERLISTMODEL_H
  2. #define NUMBERLISTMODEL_H
  3. #include <QtCore>
  4. #include "SNCCore_global.h"
  5. class SNCCORESHARED_EXPORT NumberListModel : public QAbstractListModel
  6. {
  7. Q_OBJECT
  8. public:
  9. NumberListModel(QObject *parent = 0);
  10. int rowCount(const QModelIndex &parent = QModelIndex()) const;
  11. QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
  12. void setNumberList(QStringList segments,QList<QStringList> numbers);
  13. void setOrderIndex(QList<int> orderIndex);
  14. void quickSortSegment();
  15. void mergeSegment();
  16. QStringList getSegments();
  17. QList<int> getOrderIndex();
  18. QList<QStringList> getNumbers();
  19. void clear();
  20. int getCount();
  21. void setMapIndex();
  22. QString getNumber(int row) const;
  23. QString getNumberEx(int index) const;
  24. signals:
  25. void numberPopulated(int number);
  26. void optimizeProgressMaxUpdated(int max);
  27. void optimizeProgressCurrentUpdated(int current);
  28. protected:
  29. bool canFetchMore(const QModelIndex &parent) const;
  30. void fetchMore(const QModelIndex &parent);
  31. private :
  32. void swap(int i,int j);
  33. void heapSort(int length);
  34. void heapAdjust(int i,int nLength);
  35. private:
  36. QStringList segments;
  37. QList<QStringList> numbers;
  38. QList<int> orderIndex;
  39. int displayCount;
  40. int totalCount;
  41. QList<QStringList> indexMap;
  42. QList<int> rowsIndex;
  43. QList<int> colsIndex;
  44. bool canFetch;
  45. public slots:
  46. };
  47. #endif // NUMBERLISTMODEL_H