summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-09-07 21:08:48 +0200
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-09-25 14:23:06 +0000
commit7fafeb4a3464f8f5dfaef77d2a0c9544c4600192 (patch)
tree7db1d3b1d247e08f1155e6c49a005b647c5a1ebe /src
parentd0c159c8e306709629e3af0b83b464c5cea15754 (diff)
QTreeView: sync keyboard search behavior with other itemviews
QTreeView has a special implementation of keyboardSearch() which is not consistent to the base implementation regarding the selection behavior: - currentSelectionStartIndex is not set which results in a wrong mouse selection behavior afterwards - only the current index is set but not the current selection Sync the behavior by calling setCurrentIndex() directly in QTreeView too. One problem remains with this patch - the key handling is still different between QAbstractItemView and QTreeView for repeating key presses. Task-number: QTBUG-18862 Change-Id: Ife79d146cf16d6ecbf9f86540777dae15aa1ffb0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index b534de5c6a..920e3b346b 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1088,15 +1088,8 @@ void QTreeView::keyboardSearch(const QString &search)
if (start.column() > 0)
index = index.sibling(index.row(), start.column());
- if (index.isValid()) {
- QItemSelectionModel::SelectionFlags flags = (d->selectionMode == SingleSelection
- ? QItemSelectionModel::SelectionFlags(
- QItemSelectionModel::ClearAndSelect
- |d->selectionBehaviorFlags())
- : QItemSelectionModel::SelectionFlags(
- QItemSelectionModel::NoUpdate));
- selectionModel()->setCurrentIndex(index, flags);
- }
+ if (index.isValid())
+ setCurrentIndex(index);
}
/*!