i.next();
addWord(i.key(), i.value(), wordsInBookmarks[i.key()]);
}
- //todo: repair sorting
-// sort(0);
+
+ sort(0);
}
return;
int left = 0;
- int right = _wordList.count();
+ int right = _wordList.count() - 1;
if (left < right){
if (order == Qt::AscendingOrder){
- ascendingQuickSort(left, right);
+ qSort(_wordList.begin(), _wordList.end());
} else if (order == Qt::DescendingOrder) {
- descendingQuickSort(left, right);
- }
- }
-}
-
-void WordListModel::ascendingQuickSort(int left, int right){
- int m = left;
- for(int i = left+1; i < right; i++){
- if(_wordList[i] < _wordList[left]){
- _wordList.swap(++m, i);
+ qSort(_wordList.begin(), _wordList.end(), qGreater<QString>());
}
}
-
- _wordList.swap(left, m);
- ascendingQuickSort(left, m - 1);
- ascendingQuickSort(m + 1, right);
-}
-
-void WordListModel::descendingQuickSort(int left, int right){
- int m = left;
- for(int i = left+1; i < right; i++){
- if(_wordList[i] > _wordList[left]){
- _wordList.swap(++m, i);
- }
- }
-
- _wordList.swap(left, m);
- ascendingQuickSort(left, m - 1);
- ascendingQuickSort(m + 1, right);
}
void WordListModel::setModelProperty(int index, const QVariant value, QString role)