summaryrefslogtreecommitdiff
path: root/src/controls/Private
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls/Private')
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp2
-rw-r--r--src/controls/Private/qquicktreemodeladaptor.cpp13
2 files changed, 12 insertions, 3 deletions
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp
index 95c656b2..d06f931a 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -161,7 +161,7 @@ QQmlComponent *QQuickControlSettings1::styleComponent(const QUrl &styleDirUrl, c
styleFileUrl = makeStyleComponentUrl(controlStyleName, m_styleMap.value(QStringLiteral("Base")).m_styleDirPath);
}
- return new QQmlComponent(qmlEngine(control), styleFileUrl);
+ return new QQmlComponent(qmlEngine(control), styleFileUrl, this);
}
static QString relativeStyleImportPath(QQmlEngine *engine, const QString &styleName)
diff --git a/src/controls/Private/qquicktreemodeladaptor.cpp b/src/controls/Private/qquicktreemodeladaptor.cpp
index 495abc9c..287b388f 100644
--- a/src/controls/Private/qquicktreemodeladaptor.cpp
+++ b/src/controls/Private/qquicktreemodeladaptor.cpp
@@ -283,6 +283,8 @@ QItemSelection QQuickTreeModelAdaptor1::selectionForRowRange(const QModelIndex
return QItemSelection();
return QItemSelection(toIndex, toIndex);
}
+
+ to = qMax(to, 0);
if (from > to)
qSwap(from, to);
@@ -360,8 +362,15 @@ void QQuickTreeModelAdaptor1::showModelChildItems(const TreeItem &parentItem, in
if (start == 0) {
startIdx = rowIdx;
} else {
- const QModelIndex &prevSiblingIdx = m_model->index(start - 1, 0, parentIndex);
- startIdx = lastChildIndex(prevSiblingIdx) + 1;
+ // Prefer to insert before next sibling instead of after last child of previous, as
+ // the latter is potentially buggy, see QTBUG-66062
+ const QModelIndex &nextSiblingIdx = m_model->index(end + 1, 0, parentIndex);
+ if (nextSiblingIdx.isValid()) {
+ startIdx = itemIndex(nextSiblingIdx);
+ } else {
+ const QModelIndex &prevSiblingIdx = m_model->index(start - 1, 0, parentIndex);
+ startIdx = lastChildIndex(prevSiblingIdx) + 1;
+ }
}
int rowDepth = rowIdx == 0 ? 0 : parentItem.depth + 1;