Basic support for tooltips in the tag widget

This commit is contained in:
Luca Beltrame 2015-02-20 17:35:08 +01:00
parent 2623fee54d
commit 428c1bae91

View file

@ -19,7 +19,9 @@
#include "danboorutagmodel.h"
#include "libdanbooru/danboorutag.h"
#include <QDebug>
#include <KLocalizedString>
namespace Danbooru {
@ -51,7 +53,10 @@ QVariant DanbooruTagModel::data(const QModelIndex &index, int role) const
DanbooruTag* tag = m_items.at(index.row());
if (role == Qt::DisplayRole) {
return tag->name();
QString text("%1 (%2)");
return text.arg(tag->name()).arg(tag->count());
} else if (role == Qt::ToolTipRole) {
return i18n("Tag count: %1", tag->count());
}
// TODO: More roles depending on the type of information