aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickscrollbar.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-05-19 07:05:18 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-05-19 07:05:18 +0300
commita970e15d7281d2d13485a486c6debadf46ed7950 (patch)
tree449e0526a803758301861c8a8ce9f4ed96385981 /src/quicktemplates2/qquickscrollbar.cpp
parent69c1a1e86b9774fbee6958021055c899151e1955 (diff)
parentf3377bd4d790fb07bdcac06ac9f803856fee07d9 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into tqtc/lts-5.15-opensourcev5.15.5-lts-lgpl
Diffstat (limited to 'src/quicktemplates2/qquickscrollbar.cpp')
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index 4733d665..4e2f509d 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -827,6 +827,16 @@ void QQuickScrollBarAttachedPrivate::cleanupHorizontal()
{
Q_ASSERT(flickable && horizontal);
+ QQuickControlPrivate::hideOldItem(horizontal);
+ // ScrollBar.qml has a binding to visible and ScrollView.qml has a binding to parent.
+ // If we just set visible to false and parent to null, these bindings will overwrite
+ // them upon component completion as part of the binding evaluation.
+ // That's why we remove the binding completely.
+ const QQmlProperty visibleProperty(horizontal, QStringLiteral("visible"));
+ const QQmlProperty parentProperty(horizontal, QStringLiteral("parent"));
+ QQmlPropertyPrivate::removeBinding(visibleProperty);
+ QQmlPropertyPrivate::removeBinding(parentProperty);
+
disconnect(flickable, &QQuickFlickable::movingHorizontallyChanged, this, &QQuickScrollBarAttachedPrivate::activateHorizontal);
// TODO: export QQuickFlickableVisibleArea
@@ -839,6 +849,12 @@ void QQuickScrollBarAttachedPrivate::cleanupVertical()
{
Q_ASSERT(flickable && vertical);
+ QQuickControlPrivate::hideOldItem(vertical);
+ const QQmlProperty visibleProperty(vertical, QStringLiteral("visible"));
+ const QQmlProperty parentProperty(vertical, QStringLiteral("parent"));
+ QQmlPropertyPrivate::removeBinding(visibleProperty);
+ QQmlPropertyPrivate::removeBinding(parentProperty);
+
disconnect(flickable, &QQuickFlickable::movingVerticallyChanged, this, &QQuickScrollBarAttachedPrivate::activateVertical);
// TODO: export QQuickFlickableVisibleArea
@@ -869,6 +885,9 @@ class QQuickFriendlyFlickable : public QQuickFlickable
void QQuickScrollBarAttachedPrivate::scrollHorizontal()
{
+ if (!flickable)
+ return;
+
QQuickFriendlyFlickable *f = reinterpret_cast<QQuickFriendlyFlickable *>(flickable);
const qreal viewwidth = f->width();
@@ -881,6 +900,9 @@ void QQuickScrollBarAttachedPrivate::scrollHorizontal()
void QQuickScrollBarAttachedPrivate::scrollVertical()
{
+ if (!flickable)
+ return;
+
QQuickFriendlyFlickable *f = reinterpret_cast<QQuickFriendlyFlickable *>(flickable);
const qreal viewheight = f->height();