diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-19 14:02:32 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-20 06:12:39 +0000 |
commit | 211014bfcac08ae763f8b8c8497425c48eac6a77 (patch) | |
tree | 18ec60874ed73363e52ef85c1da8c28db2b6bbd0 /src/quicktemplates2/qquickcombobox.cpp | |
parent | ce4961b063fa3bfae1996e23014d8f6b5a69f994 (diff) |
QQuickControl: implement focus handling on touch
QQuickControl::focusPolicy was only managed in mousePressEvent() and
mouseReleaseEvent(). All controls call the base class implementations
of these event handlers to get the focus policy handling "for free".
Move focus policy handling to handlePress() and handleRelease() that
can be re-used for touch events, and make sure that various controls
call the base class implementation of touch event handlers.
There's still a bit of duplication in QQuickControl::touchEvent() and
the overridden handlers in sub-classes, but this will be improved step
by step. QQuickControlPrivate::handlePress/Move/Release/Ungrab() are
planned to be made virtual, overridden in subclasses, and only called
from QQuickControl event handlers. Most mouse and touch event handlers
in QQuickControl subclasses can be removed later when we get there.
Task-number: QTBUG-58389
Change-Id: I7e82dc2ef49762a005c482ce1353e03cc841659f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickcombobox.cpp')
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 09a5eede..5c763d21 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -257,7 +257,6 @@ public: bool hasCurrentIndex; int highlightedIndex; int currentIndex; - int touchId; QVariant model; QString textRole; QString currentText; @@ -296,7 +295,6 @@ QQuickComboBoxPrivate::QQuickComboBoxPrivate() hasCurrentIndex(false), highlightedIndex(-1), currentIndex(-1), - touchId(-1), delegateModel(nullptr), delegate(nullptr), indicator(nullptr), @@ -648,14 +646,12 @@ void QQuickComboBoxPrivate::handleRelease(const QPointF &) q->setPressed(false); togglePopup(false); } - touchId = -1; } void QQuickComboBoxPrivate::handleUngrab() { Q_Q(QQuickComboBox); q->setPressed(false); - touchId = -1; } QQuickComboBox::QQuickComboBox(QQuickItem *parent) @@ -1580,9 +1576,10 @@ void QQuickComboBox::touchEvent(QTouchEvent *event) break; default: - QQuickControl::touchEvent(event); break; } + + QQuickControl::touchEvent(event); } void QQuickComboBox::touchUngrabEvent() |