From 428c1bae912b78e76ab2ec9b53058a2320b8f501 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Fri, 20 Feb 2015 17:35:08 +0100 Subject: [PATCH] Basic support for tooltips in the tag widget --- src/model/danboorutagmodel.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/model/danboorutagmodel.cpp b/src/model/danboorutagmodel.cpp index 32705f8..df25e80 100644 --- a/src/model/danboorutagmodel.cpp +++ b/src/model/danboorutagmodel.cpp @@ -19,7 +19,9 @@ #include "danboorutagmodel.h" #include "libdanbooru/danboorutag.h" +#include +#include 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