aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorBartlomiej Moskal <bartlomiej.moskal@qt.io>2021-01-21 09:52:45 +0100
committerBartlomiej Moskal <bartlomiej.moskal@qt.io>2021-02-16 14:59:57 +0100
commitfdece5a40729d7c370d920ddfcad2921183dbbec (patch)
tree7be82bc2e70d15d0f51c7caec6ca784cd72a9d30 /src/quicktemplates2
parent367edbfbc3a29827f9c34800b4de509c8629e38a (diff)
ComboBox: don't focus TextField when clicking on indicator
Remove focusing editText for Combobox when clicking on indicator (when editable is set to true). Focus on Edit Text should be set only intentionally by user. Before this change, when focus was set on Combobox, it automatically set focus on editText. It was also happening when drop down indicator was clicked. Because of that, on some platform (like Android) virtual keyboard was appearing in case when it shouldn't be shown. Fixes: QTBUG-61021 Pick-to: 5.15 6.0 Change-Id: I813dcc3099c919ec32f0683e7e60e6082c5bc389 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index c01d6394..c12ea962 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -1905,7 +1905,11 @@ void QQuickComboBox::focusInEvent(QFocusEvent *event)
{
Q_D(QQuickComboBox);
QQuickControl::focusInEvent(event);
- if (d->contentItem && isEditable())
+ // Setting focus on TextField should not be done when drop down indicator was clicked
+ // That is why, if focus is not set with key reason, it should not be passed to textEdit by default.
+ // Focus on Edit Text should be set only intentionally by user.
+ if ((event->reason() == Qt::TabFocusReason || event->reason() == Qt::BacktabFocusReason ||
+ event->reason() == Qt::ShortcutFocusReason) && d->contentItem && isEditable())
d->contentItem->forceActiveFocus(event->reason());
}