Marble

DgmlSectionTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 SPDX-FileCopyrightText: 2008 Torsten Rahn <tackat@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#include "DgmlSectionTagHandler.h"
9
10#include "MarbleDebug.h"
11
12#include "DgmlElementDictionary.h"
13#include "DgmlAttributeDictionary.h"
14#include "DgmlAuxillaryDictionary.h"
15#include "GeoParser.h"
16#include "GeoSceneLegend.h"
17#include "GeoSceneSection.h"
18
19namespace Marble
20{
21namespace dgml
22{
23DGML_DEFINE_TAG_HANDLER(Section)
24
25GeoNode* DgmlSectionTagHandler::parse(GeoParser& parser) const
26{
27 // Check whether the tag is valid
28 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_Section)));
29
30 QString name = parser.attribute(dgmlAttr_name);
31 QString checkable = parser.attribute(dgmlAttr_checkable).toLower().trimmed();
32 QString connectTo = parser.attribute(dgmlAttr_connect).trimmed();
33 QString radio = parser.attribute(dgmlAttr_radio);
34 int spacing = parser.attribute(dgmlAttr_spacing).toInt();
35
36 GeoSceneSection* section = nullptr;
37
38 // Checking for parent item
39 GeoStackItem parentItem = parser.parentElement();
40 if (parentItem.represents(dgmlTag_Legend)) {
41 section = new GeoSceneSection( name );
42 section->setCheckable( checkable == dgmlValue_true || checkable == dgmlValue_on );
43 section->setConnectTo( connectTo );
44 section->setSpacing( spacing );
45 section->setRadio( radio );
46 parentItem.nodeAs<GeoSceneLegend>()->addSection( section );
47 }
48
49 return section;
50}
51
52}
53}
QString name(StandardShortcut id)
Binds a QML item to a specific geodetic location in screen coordinates.
int toInt(bool *ok, int base) const const
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 Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.