Marble

DgmlValueTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "DgmlValueTagHandler.h"
8
9#include "DgmlAuxillaryDictionary.h"
10#include "DgmlElementDictionary.h"
11#include "GeoParser.h"
12#include "GeoSceneProperty.h"
13
14namespace Marble
15{
16namespace dgml
17{
18DGML_DEFINE_TAG_HANDLER(Value)
19
20GeoNode *DgmlValueTagHandler::parse(GeoParser &parser) const
21{
22 // Check whether the tag is valid
23 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(dgmlTag_Value)));
24
25 // Checking for parent item
26 GeoStackItem parentItem = parser.parentElement();
27 if (parentItem.represents(dgmlTag_Property)) {
28 QString parsedText = parser.readElementText().toLower().trimmed();
29 parentItem.nodeAs<GeoSceneProperty>()->setDefaultValue(parsedText == QString::fromLatin1(dgmlValue_true)
30 || parsedText == QString::fromLatin1(dgmlValue_on));
31 }
32
33 return nullptr;
34}
35
36}
37}
Binds a QML item to a specific geodetic location in screen coordinates.
QString fromLatin1(QByteArrayView str)
QString toLower() const const
QString trimmed() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.