1 #include "sortedlibrary.h"
4 SortedLibrary::SortedLibrary(QObject *parent): QSortFilterProxyModel(parent)
6 setSourceModel(Library::instance());
9 void SortedLibrary::sortBy(SortBy key)
14 bool SortedLibrary::lessThan(const QModelIndex &left,
15 const QModelIndex &right) const
17 Book *leftBook = Library::instance()->book(left);
18 Book *rightBook = Library::instance()->book(right);
25 leftString = leftBook->shortName();
26 rightString = rightBook->shortName();
29 leftString = leftBook->creators[0];
30 rightString = rightBook->creators[0];
34 return QString::localeAwareCompare(leftString, rightString);