#ifndef NUMBERLISTMODEL_H #define NUMBERLISTMODEL_H #include #include "SNCCore_global.h" class SNCCORESHARED_EXPORT NumberListModel : public QAbstractListModel { Q_OBJECT public: NumberListModel(QObject *parent = 0); int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; void setNumberList(QStringList segments,QList numbers); void setOrderIndex(QList orderIndex); void quickSortSegment(); void mergeSegment(); QStringList getSegments(); QList getOrderIndex(); QList getNumbers(); void clear(); int getCount(); void setMapIndex(); QString getNumber(int row) const; QString getNumberEx(int index) const; signals: void numberPopulated(int number); void optimizeProgressMaxUpdated(int max); void optimizeProgressCurrentUpdated(int current); protected: bool canFetchMore(const QModelIndex &parent) const; void fetchMore(const QModelIndex &parent); private : void swap(int i,int j); void heapSort(int length); void heapAdjust(int i,int nLength); private: QStringList segments; QList numbers; QList orderIndex; int displayCount; int totalCount; QList indexMap; QList rowsIndex; QList colsIndex; bool canFetch; public slots: }; #endif // NUMBERLISTMODEL_H