我有一个QList<QObject*>
,它是从ListView
模块中读入model
中的。首先,QList是一个空对象。我希望在向indexBackup
对象分配新列表时更新QList
。
import QtQuick 2.5
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.2
import QtQuick.Controls.Styles 1.0
ListView {
id: layersListView
model: settingsList //QList<QObject*> object
int indexBackup: 0
onModelChanged: {
if(indexBackup && indexBackup < model.length)
{
indexBackup = model.length
}
else
{
indexBackup = - 1
}
}
}