I have a problem with a listview element and the supply with a c++ AbstractListModel.
If I pass the listmodel via qproperty the list entries are displayed correctly.
If I pass the listmodel via qinvokable, the list is only displayed the first time the page is called up. If I call up the page a second time (regardless of whether with the same or a different listmodel), the list remains empty.
ColumnLayout { anchors.fill: parent;
ListView { id: listview; Layout.fillWidth: true; Layout.fillHeight: true;
DelegateChooser {
id: items
role: "r_type"
DelegateChoice { roleValue: type1; SelectlistDelegateITL { p_height: p_listheight; p_width: list.width; p_index: index; p_column1: r_col1; p_column2: r_col2; p_isHeader: false }}
DelegateChoice { roleValue: type2; SelectlistDelegateI2TL { p_height: p_listheight; p_width: list.width; p_index: index; p_column1: r_col1; p_column2: r_col2; p_column3: r_col3; p_isHeader: false }}
}
//model: cp_screen.selectlistModelA
model: cp_screen.getSelectlistModelB()
//currentIndex: cp_screen.getSelectlistIndex(p_key)
currentIndex: 0
header: SelectlistDelegateI2TL { p_height: p_listheight; p_width: list.width; p_index: -1; p_column1: cp_screen.getListHeaderIcon(p_key); p_column2: cp_screen.getListHeaderText(p_key); p_isHeader: true }
delegate: items
spacing: p_listspacing
}
}
QProperty:
Q_PROPERTY(SelectlistModel* selectlistModelA READ getSelectlistModelA NOTIFY signalSelectlistModelChanged)
SelectlistModel* getSelectlistModelA() { return m_model->selectlistModels.first(); }
QInvokable:
Q_INVOKABLE SelectlistModel* getSelectlistModelB() { return m_model->selectlistModels.first(); }
When trying via QInvokable, there is still the corresponding connection in the view for updating the model
Connections { target: cp_screen; function onSignalSelectlistModelChanged() { listview.model = cp_screen.getSelectlistModelB() } }
GetSelectListModelA and getSelectlistModelB return the identical model
Any idea what going wrong with QInvokable way?