PropertyStorage <-> QVariantMap

This commit is contained in:
2020-11-25 18:16:38 +03:00
parent ee6f264466
commit f891a69ee0
2 changed files with 19 additions and 0 deletions

View File

@@ -2,6 +2,23 @@
#include "qad_types.h"
PropertyStorage::PropertyStorage(const QVariantMap & pl) {
QMapIterator<QString, QVariant> it(pl);
while (it.hasNext()) {
it.next();
props << Property(it.key(), "", it.value());
}
}
QVariantMap PropertyStorage::toVariantMap() const {
QVariantMap ret;
foreach (const Property & p, props)
ret[p.name] = p.value;
return ret;
}
bool PropertyStorage::isPropertyExists(const QString & _name) const {
for (int i = 0; i < props.size(); ++i)
if (props[i].name == _name)