diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-12 15:21:25 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-12 15:24:39 (GMT) |
commit | e6558e8b25897ba9ac0a553509a0056915b0eb5c (patch) | |
tree | 988a2cfd56d552bf5718b0a6724cce238900ad30 /src | |
parent | c3b06980e96a809709c08e5b8ca98c6d7acbc9e5 (diff) | |
download | Qt-e6558e8b25897ba9ac0a553509a0056915b0eb5c.zip Qt-e6558e8b25897ba9ac0a553509a0056915b0eb5c.tar.gz Qt-e6558e8b25897ba9ac0a553509a0056915b0eb5c.tar.bz2 |
QTreeWidget visualRect now returns the rect for all columns
The autotest will follow
Task-number: QTBUG-2844
Reviewed-by: ogoffart
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/itemviews/qtreewidget.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 040c498..c133ae4 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -2851,7 +2851,14 @@ QTreeWidgetItem *QTreeWidget::itemAt(const QPoint &p) const QRect QTreeWidget::visualItemRect(const QTreeWidgetItem *item) const { Q_D(const QTreeWidget); - return visualRect(d->index(item)); + //the visual rect for an item is across all columns. So we need to determine + //what is the first and last column and get their visual index rects + QModelIndex base = d->index(item); + const int firstVisiblesection = header()->logicalIndexAt(- header()->offset()); + const int lastVisibleSection = header()->logicalIndexAt(header()->length() - header()->offset() - 1); + QModelIndex first = base.sibling(base.row(), header()->logicalIndex(firstVisiblesection)); + QModelIndex last = base.sibling(base.row(), header()->logicalIndex(lastVisibleSection)); + return visualRect(first) | visualRect(last); } /*! |