summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorThorbjørn Martsum <tmartsum@gmail.com>2013-08-26 20:26:07 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-30 21:07:46 +0200
commit2c916d47ef1338403cf14b4a2684159d865aa4fc (patch)
treec6fe82e6f84bd336320463bb7c86a3fb6bbbb2db /src/widgets
parent427037c75d7c915b9fc61cadd0a4fb5c20875547 (diff)
QTreeView - fix next focus when there is no current index
Before we went through non hidden indexes, but we never considered the visual order. This patch fixes that issue. Though it was wrong before, it probably never was a big problem since it was unlikely that the tree (on logical index 0) was swapped or hidden, but 658e42e77a00596b63823482c9b77644556b647c makes it more likely that problems with wrong focus could occur. Change-Id: Ic7b6cd2df1f8638be1a7c9e6df27f428685869fc Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 54b663274d..e4c2cfcb0c 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -2179,10 +2179,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
if (!current.isValid()) {
int i = d->below(-1);
int c = 0;
- while (c < d->header->count() && d->header->isSectionHidden(c))
+ while (c < d->header->count() && d->header->isSectionHidden(d->header->logicalIndex(c)))
++c;
if (i < d->viewItems.count() && c < d->header->count()) {
- return d->modelIndex(i, c);
+ return d->modelIndex(i, d->header->logicalIndex(c));
}
return QModelIndex();
}