TreeModel: API for setting header tool tips

Change-Id: Ieea98d244d689778db868604d981badcd166a7b5
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-06-11 15:40:30 +02:00
parent aad536cdaf
commit 2cb3fe1429
2 changed files with 9 additions and 0 deletions

View File

@@ -917,6 +917,8 @@ QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole && section < m_header.size())
return m_header.at(section);
if (role == Qt::ToolTipRole && section < m_headerToolTip.size())
return m_headerToolTip.at(section);
return QVariant();
}
@@ -976,6 +978,11 @@ void TreeModel::setHeader(const QStringList &displays)
m_columnCount = displays.size();
}
void TreeModel::setHeaderToolTip(const QStringList &tips)
{
m_headerToolTip = tips;
}
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const
{
CHECK_INDEX(parent);