Marble

KmlListItemTypeTagHandler.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2012 Mohammed Nafees <[email protected]>
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 
14 namespace Marble
15 {
16 namespace kml
17 {
18 KML_DEFINE_TAG_HANDLER( listItemType )
19 
20 GeoNode* 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 }
Type type(const QSqlDatabase &db)
QString trimmed() const const
Binds a QML item to a specific geodetic location in screen coordinates.
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.