aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickscrollbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquickscrollbar.cpp')
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index a1c9ffd431..2118f94b49 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
\list
\li \l orientation
\li \l position
- \li \l size
+ \li \l {ScrollBar::} {size}
\li \l active
\endlist
@@ -844,6 +844,7 @@ void QQuickScrollBar::hoverEnterEvent(QHoverEvent *event)
Q_D(QQuickScrollBar);
QQuickControl::hoverEnterEvent(event);
d->updateHover(event->position());
+ event->ignore();
}
void QQuickScrollBar::hoverMoveEvent(QHoverEvent *event)
@@ -851,6 +852,7 @@ void QQuickScrollBar::hoverMoveEvent(QHoverEvent *event)
Q_D(QQuickScrollBar);
QQuickControl::hoverMoveEvent(event);
d->updateHover(event->position());
+ event->ignore();
}
void QQuickScrollBar::hoverLeaveEvent(QHoverEvent *event)
@@ -859,6 +861,7 @@ void QQuickScrollBar::hoverLeaveEvent(QHoverEvent *event)
QQuickControl::hoverLeaveEvent(event);
d->updateHover(QPoint(), false); //position is not needed when we force it to unhover
+ event->ignore();
}
#endif
@@ -950,6 +953,14 @@ void QQuickScrollBarAttachedPrivate::initHorizontal()
if (parent && parent == flickable->parentItem())
horizontal->stackAfter(flickable);
+ // If a scroll bar was previously hidden (due to e.g. setting a new contentItem
+ // on a ScrollView), we need to make sure that we un-hide it.
+ // We don't bother checking if the item is actually the old one, because
+ // if it's not, all of the things the function does (setting parent, visibility, etc.)
+ // should be no-ops anyway.
+ if (auto control = qobject_cast<QQuickControl*>(q_func()->parent()))
+ QQuickControlPrivate::unhideOldItem(control, horizontal);
+
layoutHorizontal();
horizontal->setSize(area->property("widthRatio").toReal());
horizontal->setPosition(area->property("xPosition").toReal());
@@ -971,6 +982,9 @@ void QQuickScrollBarAttachedPrivate::initVertical()
if (parent && parent == flickable->parentItem())
vertical->stackAfter(flickable);
+ if (auto control = qobject_cast<QQuickControl*>(q_func()->parent()))
+ QQuickControlPrivate::unhideOldItem(control, vertical);
+
layoutVertical();
vertical->setSize(area->property("heightRatio").toReal());
vertical->setPosition(area->property("yPosition").toReal());