mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Added tooltip to folder items in the folders' treeview, it will show the complete name of the folder, usefull when the name is clipped by the parent view, plus the number of children in that folder. Only the number of subfolders can be known when the tooltip is decorated
This commit is contained in:
parent
206365f027
commit
27f9bff91b
@ -146,6 +146,18 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
FolderItem *item = static_cast<FolderItem*>(index.internalPointer());
|
||||
|
||||
if (role == Qt::ToolTipRole)
|
||||
{
|
||||
QString toolTip = item->data(FolderModel::Name).toString();
|
||||
int totalNumOfChildren = item->childCount() + item->comicNames.size();
|
||||
if(totalNumOfChildren > 0)
|
||||
{
|
||||
toolTip = toolTip + " - " + QString::number(totalNumOfChildren);
|
||||
}
|
||||
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
if (role == Qt::DecorationRole)
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
@ -175,8 +187,6 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
|
||||
|
||||
return item->data(index.column());
|
||||
}
|
||||
//! [3]
|
||||
|
Loading…
Reference in New Issue
Block a user