aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickpopup.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-05-03 21:19:09 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-05-03 21:19:09 +0200
commit87c1b763147f0dd15e7724fd2a41244dd856613c (patch)
tree2212e206ffc9085209776925c3145f1cff8d7493 /src/quicktemplates2/qquickpopup.cpp
parentea381fba363fcf9b9ef463f24eb90c5e5517fd01 (diff)
parent3af18224190d2c008a4ed6fe39b07e60db5dc683 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/imports/controls/universal/CheckDelegate.qml src/imports/controls/universal/RadioDelegate.qml src/imports/controls/universal/Switch.qml src/imports/controls/universal/SwitchDelegate.qml Change-Id: I9bca4b8d9ce3f6c5c7589daa0ced7d0353f42efc
Diffstat (limited to 'src/quicktemplates2/qquickpopup.cpp')
-rw-r--r--src/quicktemplates2/qquickpopup.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index a09c25ed..045b0fb8 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -338,7 +338,8 @@ bool QQuickPopupPrivate::handleMove(QQuickItem *item, const QPointF &point, ulon
bool QQuickPopupPrivate::handleRelease(QQuickItem *item, const QPointF &point, ulong timestamp)
{
Q_UNUSED(timestamp);
- tryClose(point, QQuickPopup::CloseOnReleaseOutside | QQuickPopup::CloseOnReleaseOutsideParent);
+ if (item != popupItem && !contains(pressPoint))
+ tryClose(point, QQuickPopup::CloseOnReleaseOutside | QQuickPopup::CloseOnReleaseOutsideParent);
pressPoint = QPointF();
touchId = -1;
return blockInput(item, point);
@@ -359,14 +360,13 @@ void QQuickPopupPrivate::handleUngrab()
bool QQuickPopupPrivate::handleMouseEvent(QQuickItem *item, QMouseEvent *event)
{
- QPointF pos = item->mapToScene(event->localPos());
switch (event->type()) {
case QEvent::MouseButtonPress:
- return handlePress(item, pos, event->timestamp());
+ return handlePress(item, event->windowPos(), event->timestamp());
case QEvent::MouseMove:
- return handleMove(item, pos, event->timestamp());
+ return handleMove(item, event->windowPos(), event->timestamp());
case QEvent::MouseButtonRelease:
- return handleRelease(item, pos, event->timestamp());
+ return handleRelease(item, event->windowPos(), event->timestamp());
default:
Q_UNREACHABLE();
return false;
@@ -1575,7 +1575,17 @@ bool QQuickPopup::hasActiveFocus() const
/*!
\qmlproperty bool QtQuick.Controls::Popup::modal
- This property holds whether the popup is modal. The default value is \c false.
+ This property holds whether the popup is modal.
+
+ Modal popups often have a distinctive background dimming effect defined
+ in \l {ApplicationWindow::overlay}{overlay.modal}, and do not allow press
+ or release events through to items beneath them.
+
+ On desktop platforms, it is common for modal popups to be closed only when
+ the escape key is pressed. To achieve this behavior, set
+ \l closePolicy to \c Popup.CloseOnEscape.
+
+ The default value is \c false.
*/
bool QQuickPopup::isModal() const
{