diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2021-05-10 12:56:39 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2021-05-19 09:58:17 +0200 |
commit | 908aa77d16e00f2bccc0ddae0f8b61955c56a6a1 (patch) | |
tree | a7f482622049cacd6299a127456ff5c5e20afdc4 /src/quicktemplates2 | |
parent | bb322df041b165f35bd6aff8910e0ae16a854f1b (diff) |
Hide old scroll bars
Reuse the hideOldItem added in 80f1186338bcf8c7d692b4fadfc46531c002c6b0
to unparent and hide them.
Fixes: QTBUG-89126
Pick-to: 6.1 5.15
Change-Id: I641e46571b8ac42e0e5080b6737f305ff59afd51
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickscrollbar.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp index a03552f7..dfa8d1bd 100644 --- a/src/quicktemplates2/qquickscrollbar.cpp +++ b/src/quicktemplates2/qquickscrollbar.cpp @@ -972,6 +972,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 @@ -984,6 +994,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 |