Added a ToStringRole to summarize the model items (for tool tip and QR code).
This commit is contained in:
@ -44,6 +44,20 @@ bool ModelItem::setItemData(const QMap<int, QVariant>& changedValues) {
|
||||
return valueChanged;
|
||||
}
|
||||
|
||||
QString ModelItem::toString() const {
|
||||
QString result;
|
||||
|
||||
QListIterator<UserRoles> i(USER_FACING_ROLES);
|
||||
while (i.hasNext()) {
|
||||
const UserRoles role = i.next();
|
||||
const QString roleName = ROLE_NAMES.value(role);
|
||||
const QVariant value = data(role);
|
||||
// result.append(value.toString());
|
||||
result.append(QString("%1: %2\n").arg(roleName, data(role).toString()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QJsonObject ModelItem::toJsonObject() const {
|
||||
QJsonObject itemObject;
|
||||
// TODO add UUID and dates (entry, modification, end)
|
||||
|
||||
Reference in New Issue
Block a user