aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-09-06 15:14:44 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-09-07 12:40:33 +0000
commit22023717774ca94b88e2b83756889b98e93aa9e3 (patch)
tree597003f07d722cca227e9dd527dcfc1ba8384758 /src
parente99c203b77743fe7554663c12a98960d8514fb6b (diff)
QQuickTableView: remove focus for the delegate item itself, not only for the child
"isAncestorOf" will not include itself as an ancestor. So we need to check if the delegate item has focus as well, since we also want to remove focus for that case. This can e.g happen if the delegate is a TextInput directly. Change-Id: I5a5f5a7ec262eacdac64d72b0f41bca991dbab73 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquicktableview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 1b4855e495..ffd0ff4fa5 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -770,7 +770,7 @@ void QQuickTableViewPrivate::releaseItem(FxTableItem *fxTableItem, QQmlTableInst
// If the item (or a descendant) has focus, remove it, so
// that the item doesn't enter with focus when it's reused.
const auto focusItem = static_cast<QQuickItem *>(window->focusObject());
- const bool hasFocus = item->isAncestorOf(focusItem);
+ const bool hasFocus = item == focusItem || item->isAncestorOf(focusItem);
if (hasFocus) {
const auto focusChild = QQuickItemPrivate::get(q)->subFocusItem;
QQuickWindowPrivate::get(window)->clearFocusInScope(q, focusChild, Qt::OtherFocusReason);