Don't add tags with no posts
This commit is contained in:
parent
7ccd845eba
commit
f6aa593ee5
1 changed files with 5 additions and 2 deletions
|
@ -53,8 +53,7 @@ QVariant DanbooruTagModel::data(const QModelIndex &index, int role) const
|
|||
DanbooruTag* tag = m_items.at(index.row());
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
QString text("%1 (%2)");
|
||||
return text.arg(tag->name()).arg(tag->count());
|
||||
return i18np("%1 (%2 post)", "%1 (%2 posts)", tag->name(), tag->count());
|
||||
} else if (role == Qt::ToolTipRole) {
|
||||
return i18n("Tag count: %1", tag->count());
|
||||
}
|
||||
|
@ -75,6 +74,10 @@ void DanbooruTagModel::addTag(DanbooruTag* tag)
|
|||
return;
|
||||
}
|
||||
|
||||
if(tag->count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
beginInsertRows(QModelIndex(), m_items.size(), m_items.size());
|
||||
m_items.append(tag);
|
||||
endInsertRows();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue