summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-24 12:18:41 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-24 12:32:38 (GMT)
commitfc835ea41dffaa7ac6247c2d0d602aadf0e0f09b (patch)
tree52067b0cc68c2bf5fcbc1fa28ab6080dad230261 /src
parent829d9e10ad3d26fb2fddef01c8e36352018c3fec (diff)
downloadQt-fc835ea41dffaa7ac6247c2d0d602aadf0e0f09b.zip
Qt-fc835ea41dffaa7ac6247c2d0d602aadf0e0f09b.tar.gz
Qt-fc835ea41dffaa7ac6247c2d0d602aadf0e0f09b.tar.bz2
Itemview: Fixes statustip not cleared
Task-number: QTBUG-1717 Reviewed-by: Thierry
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp14
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index c691fe2..ad15655 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -96,6 +96,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
autoScrollMargin(16),
autoScrollCount(0),
shouldScrollToCurrentOnShow(false),
+ shouldClearStatusTip(false),
alternatingColors(false),
textElideMode(Qt::ElideRight),
verticalScrollMode(QAbstractItemView::ScrollPerItem),
@@ -161,14 +162,15 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index
emit q->entered(index);
#ifndef QT_NO_STATUSTIP
QString statustip = model->data(index, Qt::StatusTipRole).toString();
- if (parent && !statustip.isEmpty()) {
+ if (parent && (shouldClearStatusTip || !statustip.isEmpty())) {
QStatusTipEvent tip(statustip);
QApplication::sendEvent(parent, &tip);
+ shouldClearStatusTip = !statustip.isEmpty();
}
#endif
} else {
#ifndef QT_NO_STATUSTIP
- if (parent) {
+ if (parent && shouldClearStatusTip) {
QString emptyString;
QStatusTipEvent tip( emptyString );
QApplication::sendEvent(parent, &tip);
@@ -1559,6 +1561,14 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
d->viewportEnteredNeeded = true;
break;
case QEvent::Leave:
+ #ifndef QT_NO_STATUSTIP
+ if (d->shouldClearStatusTip && d->parent) {
+ QString empty;
+ QStatusTipEvent tip(empty);
+ QApplication::sendEvent(d->parent, &tip);
+ d->shouldClearStatusTip = false;
+ }
+ #endif
d->enteredIndex = QModelIndex();
break;
case QEvent::ToolTip:
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index f1ba874..0b5cfbe 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -396,6 +396,7 @@ public:
int autoScrollMargin;
int autoScrollCount;
bool shouldScrollToCurrentOnShow; //used to know if we should scroll to current on show event
+ bool shouldClearStatusTip; //if there is a statustip currently shown that need to be cleared when leaving.
bool alternatingColors;