forked from qt-creator/qt-creator
TreeModel: API for setting header tool tips
Change-Id: Ieea98d244d689778db868604d981badcd166a7b5 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -257,6 +257,7 @@ public:
|
||||
~TreeModel();
|
||||
|
||||
void setHeader(const QStringList &displays);
|
||||
void setHeaderToolTip(const QStringList &tips);
|
||||
void clear();
|
||||
|
||||
TreeItem *rootItem() const;
|
||||
@@ -301,6 +302,7 @@ private:
|
||||
|
||||
TreeItem *m_root; // Owned.
|
||||
QStringList m_header;
|
||||
QStringList m_headerToolTip;
|
||||
int m_columnCount;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user