ListView delegate isnt able to access model properties after inserting into QAbstractItemModel
Locked
Unsolved
QML and Qt Quick
-
I have a QAbstractItemModel that I am exposing to Qml to display. When inserting a new item into it, I properly call the
beginInsertRows(QModelIndex(), index, index);
andendInsertRows();
functions. The item gets inserted correctly, but my delegate (in a ListView):delegate: Rectangle { width: bookmarksView.width height: 24 color: "red" opacity: 0.5 Label { id: bookmarkName anchors.centerIn: parent text: model.name color: Style.colorText font.pointSize: 11 } }
gives me an error that it cant assign unkown to QString on the line
text: model.name
, but after reloading the page it works fine. So it just isnt able to access it right after I have inserted the new item.Does someone have an idea why this happens?
-
S SGaist referenced this topic on
-
S SGaist locked this topic on