aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp29
-rw-r--r--src/quicktemplates2/qquickscrollbar_p.h3
-rw-r--r--src/quicktemplates2/qquickscrollbar_p_p.h2
3 files changed, 26 insertions, 8 deletions
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index ac786649..f0dd640b 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -163,6 +163,7 @@ QQuickScrollBarPrivate::QQuickScrollBarPrivate()
pressed(false),
moving(false),
interactive(true),
+ explicitInteractive(false),
orientation(Qt::Vertical),
snapMode(QQuickScrollBar::NoSnap),
policy(QQuickScrollBar::AsNeeded)
@@ -187,6 +188,19 @@ qreal QQuickScrollBarPrivate::positionAt(const QPointF &point) const
return (point.y() - q->topPadding()) / q->availableHeight();
}
+void QQuickScrollBarPrivate::setInteractive(bool enabled)
+{
+ Q_Q(QQuickScrollBar);
+ if (interactive == enabled)
+ return;
+
+ interactive = enabled;
+ q->setAcceptedMouseButtons(interactive ? Qt::LeftButton : Qt::NoButton);
+ if (!interactive)
+ q->ungrabMouse();
+ emit q->interactiveChanged();
+}
+
void QQuickScrollBarPrivate::updateActive()
{
Q_Q(QQuickScrollBar);
@@ -480,14 +494,15 @@ bool QQuickScrollBar::isInteractive() const
void QQuickScrollBar::setInteractive(bool interactive)
{
Q_D(QQuickScrollBar);
- if (d->interactive == interactive)
- return;
+ d->explicitInteractive = true;
+ d->setInteractive(interactive);
+}
- d->interactive = interactive;
- setAcceptedMouseButtons(interactive ? Qt::LeftButton : Qt::NoButton);
- if (!interactive)
- ungrabMouse();
- emit interactiveChanged();
+void QQuickScrollBar::resetInteractive()
+{
+ Q_D(QQuickScrollBar);
+ d->explicitInteractive = false;
+ d->setInteractive(true);
}
/*!
diff --git a/src/quicktemplates2/qquickscrollbar_p.h b/src/quicktemplates2/qquickscrollbar_p.h
index dabc860b..868cb5d8 100644
--- a/src/quicktemplates2/qquickscrollbar_p.h
+++ b/src/quicktemplates2/qquickscrollbar_p.h
@@ -65,7 +65,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollBar : public QQuickControl
Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL REVISION 2)
- Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL REVISION 2)
+ Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive RESET resetInteractive NOTIFY interactiveChanged FINAL REVISION 2)
Q_PROPERTY(Policy policy READ policy WRITE setPolicy NOTIFY policyChanged FINAL REVISION 2)
public:
@@ -100,6 +100,7 @@ public:
bool isInteractive() const;
void setInteractive(bool interactive);
+ void resetInteractive();
enum Policy {
AsNeeded = Qt::ScrollBarAsNeeded,
diff --git a/src/quicktemplates2/qquickscrollbar_p_p.h b/src/quicktemplates2/qquickscrollbar_p_p.h
index fa5bd0b5..cbbef2c8 100644
--- a/src/quicktemplates2/qquickscrollbar_p_p.h
+++ b/src/quicktemplates2/qquickscrollbar_p_p.h
@@ -70,6 +70,7 @@ public:
qreal snapPosition(qreal position) const;
qreal positionAt(const QPointF &point) const;
+ void setInteractive(bool interactive);
void updateActive();
void resizeContent() override;
@@ -86,6 +87,7 @@ public:
bool pressed;
bool moving;
bool interactive;
+ bool explicitInteractive;
Qt::Orientation orientation;
QQuickScrollBar::SnapMode snapMode;
QQuickScrollBar::Policy policy;