aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@gmail.com>2016-03-19 08:05:57 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-21 19:54:18 +0000
commit9d590d6313ba579a2c2112e4b314cacd05d09a50 (patch)
tree40994563221d7eafc1a113cbe316243bdd18014d /src
parent5e162c68fade8e5d4175deb92496376bd7be43d7 (diff)
Change the default value of QQuickPopup::closePolicy
When Popup::ClosePolicy was introduced, I thought that it would be better to not set OnPressOutside by default, because not all popups necessarily want to close on press outside. However, I've realized that every time I do Button { onClicked: popup.open() Popup { } } ...there's literally no interactive way to close the popup (popups don't take focus by default, so Esc doesn't work). Provided that a top-level QWidget with the Qt::Popup flag set also closes automatically on press outside, it probably makes more sense for us to follow the same pattern so that poor new users don't have to lookup the docs just to figure out how to make a popup close. :) In this case it's less troublesome to specify a different default value in those special scenarios/subclasses where closing on press outside is not desired (eg. the upcoming Popup-based Drawer). Change-Id: Iaeab4c548d63728df12232d8b65d469f0a2d80f5 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/templates/qquickpopup.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/templates/qquickpopup.cpp b/src/templates/qquickpopup.cpp
index 25053967..ab36e4cc 100644
--- a/src/templates/qquickpopup.cpp
+++ b/src/templates/qquickpopup.cpp
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
height: 300
modal: true
focus: true
- closePolicy: Popup.OnEscape | Popup.OnPressOutside
+ closePolicy: Popup.OnEscape | Popup.OnPressOutsideParent
}
}
\endqml
@@ -120,7 +120,7 @@ QQuickPopupPrivate::QQuickPopupPrivate()
, bottomMargin(0)
, contentWidth(0)
, contentHeight(0)
- , closePolicy(QQuickPopup::OnEscape)
+ , closePolicy(QQuickPopup::OnEscape | QQuickPopup::OnPressOutside)
, parentItem(nullptr)
, enter(nullptr)
, exit(nullptr)
@@ -1522,7 +1522,7 @@ void QQuickPopup::setScale(qreal scale)
\value Popup.OnEscape The popup will close when the escape key is pressed while the popup
has active focus.
- The default value is \c Popup.OnEscape.
+ The default value is \c {Popup.OnEscape | Popup.OnPressOutside}.
*/
QQuickPopup::ClosePolicy QQuickPopup::closePolicy() const
{