Marble

KmlListItemTypeTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Mohammed Nafees <nafees.technocool@gmail.com>
4//
5
6#include "KmlListItemTypeTagHandler.h"
7
8#include "MarbleDebug.h"
9
10#include "KmlElementDictionary.h"
11#include "GeoDataListStyle.h"
12#include "GeoDataParser.h"
13
14namespace Marble
15{
16namespace kml
17{
18KML_DEFINE_TAG_HANDLER( listItemType )
19
20GeoNode* KmllistItemTypeTagHandler::parse( GeoParser& parser ) const
21{
22 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_listItemType)));
23
24 GeoStackItem parentItem = parser.parentElement();
25
26 if ( parentItem.represents( kmlTag_ListStyle ) )
27 {
28 QString typeText = parser.readElementText().trimmed();
29 GeoDataListStyle::ListItemType type = GeoDataListStyle::Check;
30 if (typeText == QLatin1String("check")) {
31 type = GeoDataListStyle::Check;
32 } else if (typeText == QLatin1String("radioFolder")) {
33 type = GeoDataListStyle::RadioFolder;
34 } else if (typeText == QLatin1String("checkOffOnly")) {
35 type = GeoDataListStyle::CheckOffOnly;
36 } else if (typeText == QLatin1String("checkHideChildren")) {
37 type = GeoDataListStyle::CheckHideChildren;
38 }
39 else
40 {
41 mDebug() << "listItemType value is invalid"
42 << "falling back to default - check";
43 }
44 parentItem.nodeAs<GeoDataListStyle>()->setListItemType( type );
45 }
46 return nullptr;
47}
48
49}
50}
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
Binds a QML item to a specific geodetic location in screen coordinates.
QString trimmed() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:54:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.