diff options
author | Andy Shaw <andy.shaw@qt.io> | 2017-05-08 09:29:17 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2017-05-23 11:51:03 +0000 |
commit | d67410c61560e2728396ab49b799425d29cf6f6e (patch) | |
tree | 744f9cb06f06e96ecbc6dec41f0cd8e6b99c6457 /src/widgets | |
parent | 2ca187caa383ddc0cdebeb1dbc312405c8c871ad (diff) |
Ensure status tips for a headerview section are handled
When the mouse is moved over a header section then if there is a status
tip then this should be sent as an event like it would for a typical
QAbstractItemView.
Also adds a test for the StatusTipRole for the QTreeView itself as well as
the header.
Task-number: QTBUG-2066
Change-Id: Iaef8d91f1bd621c2463cde2dff4b2291fb037975
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index e0e993ce77..ac03ed822b 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2530,8 +2530,20 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e) if (handle != -1 && (sectionResizeMode(handle) == Interactive)) { if (!hasCursor) setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor); - } else if (hasCursor) { - unsetCursor(); + } else { + if (hasCursor) + unsetCursor(); +#ifndef QT_NO_STATUSTIP + int logical = logicalIndexAt(pos); + QString statusTip; + if (logical != -1) + statusTip = d->model->headerData(logical, d->orientation, Qt::StatusTipRole).toString(); + if (d->shouldClearStatusTip || !statusTip.isEmpty()) { + QStatusTipEvent tip(statusTip); + QCoreApplication::sendEvent(d->parent, &tip); + d->shouldClearStatusTip = !statusTip.isEmpty(); + } +#endif // !QT_NO_STATUSTIP } #endif return; |