Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.13.1, 5.14.0 Beta 1
-
None
-
-
b4c54935fb2896444f244bfee3c53f8ff18306da (qt/qtquickcontrols2/5.13)
Description
I want to use SplitView to provide a resizable column header for a custom TableView. Since those columns may change dynamically, statically defining those Items does not seem to be an option.
A Repeater would be the expected way to dynamically generate children Items, based on some data model. Unfortunately, the Repeater's delegates are never instantiated, also the Repeater itself isn't listed as a child of the SplitView.
I created this an example .qml to demonstrate the problem.
Expected behaviour: More than one child of SplitView is listed on the console, and multiple colored Rectangles are created visually.
Actual behaviour: Only the statically defined Rectangle is attached and drawn.
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.13 Window { visible: true width: 640 height: 480 SplitView { id: header anchors.fill: parent property variant colors: ["red", "green", "blue"] Rectangle { color: "pink" SplitView.preferredHeight: 20 SplitView.preferredWidth: 100 } Repeater { model: header.colors.length delegate: Rectangle { color: header.colors[index] SplitView.preferredHeight: 20 SplitView.preferredWidth: 100 Component.onCompleted: console.log("Repeater delegate instantiated") } } Component.onCompleted: { for (var child in header.contentChildren) { console.log(child, header.contentChildren[child]) } } } }
QTBUG-51235 seems related, but i decided to open this issue anyway, because it refers to Quick Controls 1 and will probably not be looked at in the near future.