0
votes

I create collapsible panel in qml with listview and controls loads dynamically.

property Component textBoxComponent;
property Component comboBoxComponent;
property Component twoStateBoxComponent;
property Component sliderComponent;

Component.onCompleted:  {
    textBoxComponent = Qt.createComponent("MyTextBox.qml")
    comboBoxComponent = Qt.createComponent("MyCombobox.qml")
    twoStateBoxComponent = Qt.createComponent("CheckBoxSwitcher.qml")
    sliderComponent = Qt.createComponent("MySlider.qml")
}

This components are used in listview delegate like this:

componentContainer.sourceComponent = comboBoxComponent
componentContainer.item.comboItems = displayValues
componentContainer.item.parameterName = settingName
componentContainer.item.width = ScriptStyles.parameterControlWidth

This code executing in function "Component.onCompleted". Here "componentContainer" is "Loader" element. It's all works fine till i hide listview (change height and opacity to 0. And also tried to set 0.05 value). Like this:

states: [
        State {
            name: "collapsed"
            PropertyChanges {
                target: listView
                height: 0
                opacity: 0
            }
]

After expanding some controls stay as before collapsing and some recreated (Destruction executes while collapsing). How i can prevent destruction of my objectes?

1
You should answer your own question (or delete it).Mitch

1 Answers

0
votes

I found the solution. ListView element has property cacheBuffer which determines whether delegates are retained outside the visible area of the view.