aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickpopup.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-04-25 08:41:40 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-04-27 12:44:44 +0000
commit3d6d026602cf9a6ccc35655347c2ed6267bbc49f (patch)
treebbf7b3e017d50b5c6e3cbb425c279b9d2f6da4b5 /src/quicktemplates2/qquickpopup.cpp
parent3851ae607c6bb1b77bde99172ebd8a1ff6929c39 (diff)
Popup: separate modal and modeless background dimming
iOS generally has white popups on white background, so it must dim the overlay background also for modeless popups to make them stand out. Make it possible to have modal and modeless background dimming separately, because both might be visible at the same time (eg. in Gallery settings). Change-Id: Id990675c8d06ceb8f8a26e6505d4bd020069f297 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/quicktemplates2/qquickpopup.cpp')
-rw-r--r--src/quicktemplates2/qquickpopup.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 13e562d0..5b10bb12 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -121,6 +121,8 @@ QQuickPopupPrivate::QQuickPopupPrivate()
: QObjectPrivate()
, focus(false)
, modal(false)
+ , dim(false)
+ , hasDim(false)
, visible(false)
, complete(false)
, hasTopMargin(false)
@@ -1520,6 +1522,49 @@ void QQuickPopup::setModal(bool modal)
return;
d->modal = modal;
emit modalChanged();
+
+ if (!d->hasDim) {
+ setDim(modal);
+ d->hasDim = false;
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Popup::dim
+
+ This property holds whether the popup dims the background.
+
+ Unless explicitly set, this property follows the value of \l modal. To
+ return to the default value, set this property to \c undefined.
+
+ \sa modal
+*/
+bool QQuickPopup::dim() const
+{
+ Q_D(const QQuickPopup);
+ return d->dim;
+}
+
+void QQuickPopup::setDim(bool dim)
+{
+ Q_D(QQuickPopup);
+ d->hasDim = true;
+
+ if (d->dim == dim)
+ return;
+
+ d->dim = dim;
+ emit dimChanged();
+}
+
+void QQuickPopup::resetDim()
+{
+ Q_D(QQuickPopup);
+ if (!d->hasDim)
+ return;
+
+ setDim(d->modal);
+ d->hasDim = false;
}
/*!