Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.8, 5.15.2, 5.15.3
-
None
Description
In the enclosed sample:
- The top ScrollView is working fine
- With the second, where the code is inline, the program will crash without this commit when pressing the Scrollbar (see stack trace below). With the fix, the scrollbar is still unusable (dragging on the scrollbar doesn't change the view's position).
#0 0x00007f1aae43bc30 in QQuickItem::width() const ()
from /home/pierre/Qt/5.15.2/gcc_64/bin/../lib/libQt5Quick.so.5
#1 0x00007f1a782d2785 in QQuickScrollBarAttachedPrivate::scrollHorizontal() ()
from /home/pierre/Qt/5.15.2/gcc_64/qml/QtQuick/Controls.2/../../../lib/libQt5QuickTemplates2.so.5
#2 0x00007f1aab8d5f30 in void doActivate<false>(QObject*, int, void**) ()
from /home/pierre/Qt/5.15.2/gcc_64/bin/../lib/libQt5Core.so.5
#3 0x00007f1a782d2a64 in QQuickScrollBar::setPosition(double) ()
from /home/pierre/Qt/5.15.2/gcc_64/qml/QtQuick/Controls.2/../../../lib/libQt5QuickTemplates2.so.5
#4 0x00007f1a782a36d5 in QQuickControl::mouseMoveEvent(QMouseEvent*) ()
from /home/pierre/Qt/5.15.2/gcc_64/qml/QtQuick/Controls.2/../../../lib/libQt5QuickTemplates2.so.5
#5 0x00007f1aae449f5e in QQuickItem::event(QEvent*) ()
from /home/pierre/Qt/5.15.2/gcc_64/bin/../lib/libQt5Quick.so.5[...]
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 import QtQuick.Templates 2.12 as T Window { width: 300 height: 400 visible: true title: qsTr("Example") component MyScrollView: T.ScrollView { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding) ScrollBar.horizontal: ScrollBar { parent: control x: control.leftPadding y: control.height - height width: control.availableWidth } } MyScrollView { id: view1 height: 200 anchors { top: parent.top left: parent.left right: parent.right } contentWidth: r1.width contentHeight: r1.height Rectangle { id: r1 width: 500 height: 200 gradient: Gradient { orientation: Gradient.Horizontal GradientStop { position: 0.0; color: "red" } GradientStop { position: 1.0; color: "green" } } } } T.ScrollView { id: view2 height: 200 anchors { top: view1.bottom left: parent.left right: parent.right } implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding) contentWidth: r2.width contentHeight: r2.height ScrollBar.horizontal: ScrollBar { parent: view2 x: view2.leftPadding y: view2.height - height width: view2.availableWidth } Rectangle { id: r2 width: 500 height: 200 gradient: Gradient { orientation: Gradient.Horizontal GradientStop { position: 0.0; color: "blue" } GradientStop { position: 1.0; color: "yellow" } } } } }