summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-22 18:17:40 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-06-23 22:09:45 +0200
commita780d2ddedb769eba44263ae46684080d7ddc843 (patch)
tree6698d86038e3f48422a54f2f0ab59d665275378a
parentf433dbf758c5d7159b4b0431f819214c804424d0 (diff)
downloadqtquickcontrols-a780d2ddedb769eba44263ae46684080d7ddc843.tar.gz
ComboBox: open the popup on release on touch devices
This is the common behavior on touch devices, and avoids such problems as opening the popup while trying to flick a ScrollView that contains a ComboBox. Change-Id: I9207bc2c00524fe4cd5a673f4fe505f6db825838 Reviewed-by: Caroline Chao <caroline.chao@digia.com>
-rw-r--r--src/controls/ComboBox.qml15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 9cb2a9f4..cc949153 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -153,7 +153,7 @@ Control {
/*! \qmlproperty bool ComboBox::pressed
This property holds whether the button is being pressed. */
- readonly property bool pressed: mouseArea.pressed && mouseArea.containsMouse || popup.__popupVisible
+ readonly property bool pressed: mouseArea.effectivePressed || popup.__popupVisible
/*! \qmlproperty bool ComboBox::hovered
@@ -309,12 +309,23 @@ Control {
MouseArea {
id: mouseArea
+ property bool overridePressed: false
+ readonly property bool effectivePressed: (pressed || overridePressed) && containsMouse
anchors.fill: parent
hoverEnabled: true
onPressed: {
if (comboBox.activeFocusOnPress)
forceActiveFocus()
- popup.show()
+ if (!Settings.hasTouchScreen)
+ popup.show()
+ else
+ overridePressed = true
+ }
+ onCanceled: overridePressed = false
+ onClicked: {
+ if (Settings.hasTouchScreen)
+ popup.show()
+ overridePressed = false
}
onWheel: {
if (wheel.angleDelta.y > 0) {