Commit b669753d authored by Nate Weibley's avatar Nate Weibley

Add QmlObjectListModel method to replace an entire model's data in one step

parent e95fd88b
......@@ -179,6 +179,15 @@ void QmlObjectListModel::append(QObject* object)
insert(_objectList.count(), object);
}
QObjectList QmlObjectListModel::swapObjectList(QObjectList newlist)
{
QObjectList oldlist(_objectList);
beginResetModel();
_objectList = newlist;
endResetModel();
return oldlist;
}
int QmlObjectListModel::count(void) const
{
return rowCount();
......
......@@ -37,6 +37,7 @@ public:
void setDirty(bool dirty);
void append(QObject* object);
QObjectList swapObjectList(QObjectList newlist);
void clear(void);
QObject* removeAt(int i);
QObject* removeOne(QObject* object) { return removeAt(indexOf(object)); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment