aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdrawer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquickdrawer.cpp')
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 36493e79..a465a13e 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -36,6 +36,7 @@
#include "qquickdrawer_p.h"
#include "qquickdrawer_p_p.h"
+#include "qquickpopupitem_p_p.h"
#include <QtGui/qstylehints.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -238,7 +239,7 @@ static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int th
bool QQuickDrawerPrivate::startDrag(QQuickWindow *window, QMouseEvent *event)
{
- if (!window || dragMargin < 0.0 || qFuzzyIsNull(dragMargin))
+ if (!window || !interactive || dragMargin < 0.0 || qFuzzyIsNull(dragMargin))
return false;
bool drag = false;
@@ -271,7 +272,7 @@ bool QQuickDrawerPrivate::startDrag(QQuickWindow *window, QMouseEvent *event)
bool QQuickDrawerPrivate::grabMouse(QMouseEvent *event)
{
Q_Q(QQuickDrawer);
- if (!window || popupItem->keepMouseGrab())
+ if (!window || !interactive || popupItem->keepMouseGrab())
return false;
const QPointF movePoint = event->windowPos();
@@ -541,6 +542,8 @@ void QQuickDrawer::setPosition(qreal position)
prevents opening the drawer by dragging.
The default value is \c Qt.styleHints.startDragDistance.
+
+ \sa interactive
*/
qreal QQuickDrawer::dragMargin() const
{
@@ -563,6 +566,34 @@ void QQuickDrawer::resetDragMargin()
setDragMargin(QGuiApplication::styleHints()->startDragDistance());
}
+/*!
+ \since QtQuick.Controls 2.2
+ \qmlproperty bool QtQuick.Controls::Drawer::interactive
+
+ This property holds whether the drawer is interactive. A non-interactive
+ drawer does not react to swipes.
+
+ The default value is \c true.
+
+ \sa dragMargin
+*/
+bool QQuickDrawer::isInteractive() const
+{
+ Q_D(const QQuickDrawer);
+ return d->interactive;
+}
+
+void QQuickDrawer::setInteractive(bool interactive)
+{
+ Q_D(QQuickDrawer);
+ if (d->interactive == interactive)
+ return;
+
+ setFiltersChildMouseEvents(interactive);
+ d->interactive = interactive;
+ emit interactiveChanged();
+}
+
bool QQuickDrawer::childMouseEventFilter(QQuickItem *child, QEvent *event)
{
Q_D(QQuickDrawer);