complete WordListWidget with model.
[mdictionary] / src / mdictionary / gui / WordListModel.h
index a01d9ee..2db6e3b 100644 (file)
@@ -17,7 +17,7 @@ public:
         NumberRole
     };
 
-    explicit WordListModel(/*QHash<QString, QList<Translation*> > translations, QHash<QString, bool> wordsInBookmarks, */QObject *parent = 0);
+    explicit WordListModel(QObject *parent = 0);
 
     int rowCount(const QModelIndex & parent = QModelIndex()) const;
 
@@ -34,13 +34,9 @@ public:
     //! Clear model data and refresh UI
     void clear();
 
-signals:
+    void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
 
-//    //! Set index of current selected word
-//    /*!
-//      \param index word position in data list
-//      */
-//    void itemSelected(int index);
+signals:
 
     void addToBookmarks(QString word);
 
@@ -64,6 +60,9 @@ private:
     QHash<QString, bool > _wordInBookmarks;
     QList<QString> _wordList;
 
+    void ascendingQuickSort(int left, int right);
+    void descendingQuickSort(int left, int right);
+
 };
 
 #endif // WORDLISTMODEL_H