finished loading function
This commit is contained in:
parent
ae7911fd51
commit
7a038ac141
2 changed files with 26 additions and 0 deletions
|
@ -580,9 +580,34 @@ bool ServiceItemModel::load(QUrl file) {
|
||||||
|
|
||||||
QVariantList serviceList = array.toVariantList();
|
QVariantList serviceList = array.toVariantList();
|
||||||
qDebug() << serviceList;
|
qDebug() << serviceList;
|
||||||
|
|
||||||
|
// now lets remove all items from current list and add loaded ones
|
||||||
|
clearAll();
|
||||||
|
|
||||||
|
for (int i = 0; i < serviceList.length(); i++) {
|
||||||
|
// int id = serviceList
|
||||||
|
qDebug() << "*********************************";
|
||||||
|
qDebug() << serviceList[i].toMap();
|
||||||
|
qDebug() << "*********************************";
|
||||||
|
|
||||||
|
QMap item = serviceList[i].toMap();
|
||||||
|
|
||||||
|
insertItem(i, item.value("name").toString(), item.value("type").toString(),
|
||||||
|
item.value("background").toString(),
|
||||||
|
item.value("backgroundType").toString(),
|
||||||
|
item.value("text").toStringList(), item.value("audio").toString(),
|
||||||
|
item.value("font").toString(), item.value("fontSize").toInt());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServiceItemModel::clearAll() {
|
||||||
|
for (int i = m_items.size(); i >= 0; i--) {
|
||||||
|
removeItem(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
Q_INVOKABLE bool activate(int id);
|
Q_INVOKABLE bool activate(int id);
|
||||||
Q_INVOKABLE QVariantMap getItem(int index) const;
|
Q_INVOKABLE QVariantMap getItem(int index) const;
|
||||||
Q_INVOKABLE QVariantList getItems();
|
Q_INVOKABLE QVariantList getItems();
|
||||||
|
Q_INVOKABLE void clearAll();
|
||||||
|
|
||||||
Q_INVOKABLE bool save(QUrl file);
|
Q_INVOKABLE bool save(QUrl file);
|
||||||
Q_INVOKABLE bool load(QUrl file);
|
Q_INVOKABLE bool load(QUrl file);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue