diff --git a/src/model/danboorutagmodel.cpp b/src/model/danboorutagmodel.cpp index ed638f8..7a6d517 100644 --- a/src/model/danboorutagmodel.cpp +++ b/src/model/danboorutagmodel.cpp @@ -56,6 +56,8 @@ QVariant DanbooruTagModel::data(const QModelIndex &index, int role) const return i18np("%1 (%2 post)", "%1 (%2 posts)", tag->name(), tag->count()); } else if (role == Qt::ToolTipRole) { return i18n("Tag count: %1", tag->count()); + } else if (role == TagCountRole) { + return tag->count(); } // TODO: More roles depending on the type of information diff --git a/src/model/danboorutagmodel.h b/src/model/danboorutagmodel.h index 42ee03c..e532889 100644 --- a/src/model/danboorutagmodel.h +++ b/src/model/danboorutagmodel.h @@ -40,6 +40,11 @@ public: void clear(); DanbooruTag* itemAt(int index) const; + enum TagRoles { + // Needed for sorting through the proxy model + TagCountRole = Qt::UserRole + 4000 + }; + private: QVector m_items;