• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • plugins
  • declarative
DeclarativeMapThemeManager.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2010 Dennis Nienhüser <earthwings@gentoo.org>
9 //
10 
11 #include "DeclarativeMapThemeManager.h"
12 
13 #include "GeoSceneDocument.h"
14 #include "GeoSceneHead.h"
15 
16 #include <QIcon>
17 #include <QStandardItemModel>
18 #include <QDebug>
19 
20 MapThemeImageProvider::MapThemeImageProvider() :
21  QQuickImageProvider( QQuickImageProvider::Pixmap )
22 {
23  // nothing to do
24 }
25 
26 QPixmap MapThemeImageProvider::requestPixmap( const QString &id, QSize *size, const QSize &requestedSize )
27 {
28  QSize const resultSize = requestedSize.isValid() ? resultSize : QSize( 128, 128 );
29  if ( size ) {
30  *size = resultSize;
31  }
32 
33  QStandardItemModel *model = m_mapThemeManager.mapThemeModel();
34  for( int i = 0; i < model->rowCount(); ++i ) {
35  if ( model->data( model->index( i, 0 ), Qt::UserRole + 1 ) == id ) {
36  QIcon icon = model->data( model->index( i, 0 ), Qt::DecorationRole ).value<QIcon>();
37  QPixmap result = icon.pixmap( resultSize );
38  return result;
39  }
40  }
41 
42  QPixmap empty( resultSize );
43  empty.fill();
44  return empty;
45 }
46 
47 MapThemeManager::MapThemeManager( QObject *parent ) : QObject( parent )
48 {
49  // nothing to do
50 }
51 
52 QStringList MapThemeManager::mapThemeIds() const
53 {
54  return m_mapThemeManager.mapThemeIds();
55 }
56 
57 #include "DeclarativeMapThemeManager.moc"
GeoSceneHead.h
Marble::MapThemeManager::mapThemeModel
QStandardItemModel * mapThemeModel()
Provides a model of the locally existing themes.
Definition: MapThemeManager.cpp:319
MapThemeImageProvider::MapThemeImageProvider
MapThemeImageProvider()
Definition: DeclarativeMapThemeManager.cpp:20
QQuickImageProvider
GeoSceneDocument.h
MapThemeManager::MapThemeManager
MapThemeManager(QObject *parent=0)
Constructor.
Definition: DeclarativeMapThemeManager.cpp:47
QObject
MapThemeManager::mapThemeIds
QStringList mapThemeIds() const
A list of all installed map theme ids, each entry has the form "planet/themeid/themeid.dgml", e.g.
Definition: DeclarativeMapThemeManager.cpp:52
MapThemeImageProvider::requestPixmap
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
Definition: DeclarativeMapThemeManager.cpp:26
DeclarativeMapThemeManager.h
Marble::MapThemeManager::mapThemeIds
QStringList mapThemeIds() const
Returns a list of all locally available map theme IDs.
Definition: MapThemeManager.cpp:138
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal