From 45751d0ea3c4325f8f8c33969015763b5b897e77 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Date: Mon, 18 May 2015 10:52:06 +0200
Subject: [PATCH] Fix combobox regression 5.4 -> 5.5

To avoid a touch release outside the combobox triggering the popup,
a check was added that the combobox was hit. This fails if the combox
itself is only used for the popup and associated behavior, but does
not exist as widget. This patch changes the check so that only touch
release checks for a hit, but a generic click still behaves as in 5.4
to avoid regressions.

This fixes comboboxes no longer working in QtWebKit, since QtWebKit
renders its own comboxes in webpages, and only uses the popup of
the QComboBox.


Task-number: QTBUG-46152
Change-Id: I74fd57b2e42e77aa4a269d812ca4a6689f254889
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
---
 src/widgets/widgets/qcombobox.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 76f923904dd..ef80e359df2 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -3034,7 +3034,7 @@ void QComboBoxPrivate::showPopupFromMouseEvent(QMouseEvent *e)
     QStyle::SubControl sc = q->style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, e->pos(), q);
 
     if (e->button() == Qt::LeftButton
-            && sc != QStyle::SC_None
+            && !(sc == QStyle::SC_None && e->type() == QEvent::MouseButtonRelease)
             && (sc == QStyle::SC_ComboBoxArrow || !q->isEditable())
             && !viewContainer()->isVisible()) {
         if (sc == QStyle::SC_ComboBoxArrow)
-- 
GitLab