File indexing completed on 2024-05-12 04:42:45

0001 /*
0002     SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "variant_p.h"
0008 
0009 #include <QMetaObject>
0010 #include <QMetaProperty>
0011 
0012 using namespace KPublicTransport;
0013 
0014 void Variant::fromVariantMap(const QMetaObject *mo, const QVariantMap &v, void *obj)
0015 {
0016     for (auto it = v.begin(); it != v.end(); ++it) {
0017         const auto idx = mo->indexOfProperty(it.key().toUtf8().constData());
0018         if (idx < 0) {
0019             continue;
0020         }
0021 
0022         const auto prop = mo->property(idx);
0023         if (!prop.isStored()) {
0024             continue;
0025         }
0026 
0027         prop.writeOnGadget(obj, it.value());
0028     }
0029 }