diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-05-19 07:05:18 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-05-19 07:05:18 +0300 |
commit | a970e15d7281d2d13485a486c6debadf46ed7950 (patch) | |
tree | 449e0526a803758301861c8a8ce9f4ed96385981 /src/quicktemplates2/qquickscrollview.cpp | |
parent | 69c1a1e86b9774fbee6958021055c899151e1955 (diff) | |
parent | f3377bd4d790fb07bdcac06ac9f803856fee07d9 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into tqtc/lts-5.15-opensourcev5.15.5-lts-lgpl
Change-Id: Iec31024aafdb1785574ba6450ca754f4660c05ee
Diffstat (limited to 'src/quicktemplates2/qquickscrollview.cpp')
-rw-r--r-- | src/quicktemplates2/qquickscrollview.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp index f385778d..01e19b16 100644 --- a/src/quicktemplates2/qquickscrollview.cpp +++ b/src/quicktemplates2/qquickscrollview.cpp @@ -38,6 +38,7 @@ #include "qquickpane_p_p.h" #include "qquickscrollbar_p_p.h" +#include <QtQml/qqmlinfo.h> #include <QtQuick/private/qquickflickable_p.h> QT_BEGIN_NAMESPACE @@ -575,7 +576,10 @@ void QQuickScrollView::contentItemChange(QQuickItem *newItem, QQuickItem *oldIte // assume/require that it has an explicit content size assigned. d->flickableHasExplicitContentWidth = true; d->flickableHasExplicitContentHeight = true; - d->setFlickable(qobject_cast<QQuickFlickable *>(newItem), false); + auto newItemAsFlickable = qobject_cast<QQuickFlickable *>(newItem); + if (newItem && !newItemAsFlickable) + qmlWarning(this) << "ScrollView only supports Flickable types as its contentItem"; + d->setFlickable(newItemAsFlickable, false); } QQuickPane::contentItemChange(newItem, oldItem); } |