Don't replay mouse press event which closes a popup on X11

Add a new style hint to QPlatformIntegration: ReplayMousePressOutsidePopup.
Return false for it in the xcb plugin.

This commit restores the behavior which was in Qt 4.

Task-number: QTBUG-34814
Change-Id: I19fee762395a51475cc67b52b368c70679ca736b
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Alexander Volkov 2015-03-19 14:51:53 +03:00
parent 722f9f9477
commit 738c07542a
4 changed files with 8 additions and 2 deletions

View File

@ -392,6 +392,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return QPlatformTheme::defaultThemeHint(QPlatformTheme::MousePressAndHoldInterval);
case TabFocusBehavior:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior);
case ReplayMousePressOutsidePopup:
return true;
}
return 0;

View File

@ -145,7 +145,8 @@ public:
SetFocusOnTouchRelease,
ShowIsMaximized,
MousePressAndHoldInterval,
TabFocusBehavior
TabFocusBehavior,
ReplayMousePressOutsidePopup
};
virtual QVariant styleHint(StyleHint hint) const;

View File

@ -374,6 +374,8 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
// X11 always has support for windows, but the
// window manager could prevent it (e.g. matchbox)
return false;
case QPlatformIntegration::ReplayMousePressOutsidePopup:
return false;
default:
break;
}

View File

@ -465,7 +465,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
}
if (qApp->activePopupWidget() != activePopupWidget
&& qt_replay_popup_mouse_event) {
&& qt_replay_popup_mouse_event
&& QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ReplayMousePressOutsidePopup).toBool()) {
if (m_widget->windowType() != Qt::Popup)
qt_button_down = 0;
if (event->type() == QEvent::MouseButtonPress) {