summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-01-11 11:39:19 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2010-01-11 11:53:06 +0100
commit820db2b2c5a0fc470fa5759d95ea49305ec98654 (patch)
tree1fc8274854a0ecb2447bbeb67a5dabf94023f567 /src/gui/itemviews/qabstractitemview.cpp
parent45fedfeb405807453e94958808c2f1d48bb846ca (diff)
Fix incorrect drawing of the hovered row on QTreeView with some styles.
Some styles such as oxygen, or gtk, require the whole row to be redrawn in case of mouse hover the items. There was special code that handle that in the MouseMove event of the QTreeView, but that did not covered all the case (such as scrolling with the mouse wheel) Reviewed-by: Gabriel
Diffstat (limited to 'src/gui/itemviews/qabstractitemview.cpp')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index f447989ff6..f852e67f16 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -146,9 +146,16 @@ void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index)
if (hover == index)
return;
- q->update(hover); //update the old one
+ if (selectionBehavior != QAbstractItemView::SelectRows) {
+ q->update(hover); //update the old one
+ q->update(index); //update the new one
+ } else {
+ QRect oldHoverRect = q->visualRect(hover);
+ QRect newHoverRect = q->visualRect(index);
+ viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height()));
+ viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height()));
+ }
hover = index;
- q->update(hover); //update the new one
}
void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index)