StatusQ: Add insert overload taking array as input

This commit is contained in:
Michał Cieślak 2024-01-16 10:15:28 +01:00 committed by Michał
parent e68d46da99
commit 8ac6c21782
2 changed files with 6 additions and 0 deletions

View File

@ -91,6 +91,11 @@ void ListModelWrapper::insert(int index, const QJsonObject& dict) {
runExpression(QString("insert(%1, %2)").arg(index).arg(jsonDict));
}
void ListModelWrapper::insert(int index, const QJsonArray& data) {
QString jsonData = QJsonDocument(data).toJson();
runExpression(QString("insert(%1, %2)").arg(index).arg(jsonData));
}
void ListModelWrapper::append(const QJsonArray& data) {
QString jsonData = QJsonDocument(data).toJson();
runExpression(QString("append(%1)").arg(jsonData));

View File

@ -25,6 +25,7 @@ public:
QVariant get(int index, const QString& roleName);
void insert(int index, const QJsonObject& dict);
void insert(int index, const QJsonArray& data);
void append(const QJsonArray& data);
void clear();
void remove(int index, int count = 1);