aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickpopup.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-04-20 15:43:07 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-04-20 18:05:16 +0000
commitb12641c50c9cd82e65e14df70cd1dbb388acc006 (patch)
tree7d209aa8b00c895c58bc5a6549a688556ce80eab /src/quicktemplates2/qquickpopup.cpp
parent692f49e85f3b3b38ba4cb8835b6e505b9648b07f (diff)
Popup: rename close policy flags
Even though it gets a bit long, it's much easier to remember close policy values that start with "Close". Even with auto-completion, one still has to type something for Qt Creator to know what to complete. That's where consistency (closePolicy -> CloseFoo, snapMode -> SnapBar) helps. Change-Id: Idc86322c0d1e367fad87eb1deafbf58ef6ddb04d Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/quicktemplates2/qquickpopup.cpp')
-rw-r--r--src/quicktemplates2/qquickpopup.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 04bee8a3..da9d5fe0 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
height: 300
modal: true
focus: true
- closePolicy: Popup.OnEscape | Popup.OnPressOutsideParent
+ closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}
}
\endqml
@@ -136,7 +136,7 @@ QQuickPopupPrivate::QQuickPopupPrivate()
, bottomMargin(0)
, contentWidth(0)
, contentHeight(0)
- , closePolicy(QQuickPopup::OnEscape | QQuickPopup::OnPressOutside)
+ , closePolicy(QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutside)
, parentItem(nullptr)
, enter(nullptr)
, exit(nullptr)
@@ -158,8 +158,8 @@ bool QQuickPopupPrivate::tryClose(QQuickItem *item, QMouseEvent *event)
{
Q_Q(QQuickPopup);
const bool isPress = event->type() == QEvent::MouseButtonPress;
- const bool onOutside = closePolicy.testFlag(isPress ? QQuickPopup::OnPressOutside : QQuickPopup::OnReleaseOutside);
- const bool onOutsideParent = closePolicy.testFlag(isPress ? QQuickPopup::OnPressOutsideParent : QQuickPopup::OnReleaseOutsideParent);
+ const bool onOutside = closePolicy.testFlag(isPress ? QQuickPopup::CloseOnPressOutside : QQuickPopup::CloseOnReleaseOutside);
+ const bool onOutsideParent = closePolicy.testFlag(isPress ? QQuickPopup::CloseOnPressOutsideParent : QQuickPopup::CloseOnReleaseOutsideParent);
if (onOutside || onOutsideParent) {
if (!popupItem->contains(item->mapToItem(popupItem, event->pos()))) {
if (!onOutsideParent || !parentItem || !parentItem->contains(item->mapToItem(parentItem, event->pos()))) {
@@ -1552,14 +1552,14 @@ void QQuickPopup::setScale(qreal scale)
The available values are:
\value Popup.NoAutoClose The popup will only close when manually instructed to do so.
- \value Popup.OnPressOutside The popup will close when the mouse is pressed outside of it.
- \value Popup.OnPressOutsideParent The popup will close when the mouse is pressed outside of its parent.
- \value Popup.OnReleaseOutside The popup will close when the mouse is released outside of it.
- \value Popup.OnReleaseOutsideParent The popup will close when the mouse is released outside of its parent.
- \value Popup.OnEscape The popup will close when the escape key is pressed while the popup
+ \value Popup.CloseOnPressOutside The popup will close when the mouse is pressed outside of it.
+ \value Popup.CloseOnPressOutsideParent The popup will close when the mouse is pressed outside of its parent.
+ \value Popup.CloseOnReleaseOutside The popup will close when the mouse is released outside of it.
+ \value Popup.CloseOnReleaseOutsideParent The popup will close when the mouse is released outside of its parent.
+ \value Popup.CloseOnEscape The popup will close when the escape key is pressed while the popup
has active focus.
- The default value is \c {Popup.OnEscape | Popup.OnPressOutside}.
+ The default value is \c {Popup.CloseOnEscape | Popup.CloseOnPressOutside}.
*/
QQuickPopup::ClosePolicy QQuickPopup::closePolicy() const
{
@@ -1709,7 +1709,7 @@ void QQuickPopup::keyPressEvent(QKeyEvent *event)
if (event->key() != Qt::Key_Escape)
return;
- if (d->closePolicy.testFlag(OnEscape))
+ if (d->closePolicy.testFlag(CloseOnEscape))
close();
}