KPublicTransport

variant.cpp
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "variant_p.h"
8
9#include <QMetaObject>
10#include <QMetaProperty>
11
12using namespace KPublicTransport;
13
14void Variant::fromVariantMap(const QMetaObject *mo, const QVariantMap &v, void *obj)
15{
16 for (auto it = v.begin(); it != v.end(); ++it) {
17 const auto idx = mo->indexOfProperty(it.key().toUtf8().constData());
18 if (idx < 0) {
19 continue;
20 }
21
22 const auto prop = mo->property(idx);
23 if (!prop.isStored()) {
24 continue;
25 }
26
27 prop.writeOnGadget(obj, it.value());
28 }
29}
Query operations and data types for accessing realtime public transport information from online servi...
int indexOfProperty(const char *name) const const
QMetaProperty property(int index) const const
bool writeOnGadget(void *gadget, QVariant &&value) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Apr 27 2024 22:06:47 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.