QGIS API Documentation  3.27.0-Master (0e23467727)
qgsquickplugin.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsquickplugin.cpp
3  --------------------------------------
4  Date : Nov 2017
5  Copyright : (C) 2017 by Peter Petrik
6  Email : zilolv at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include <qqml.h>
17 
18 #include <QObject>
19 #include <QQmlEngine>
20 #include <QJSEngine>
21 
22 #include "qgsfeature.h"
23 #include "qgslogger.h"
24 #include "qgsmaplayer.h"
25 #include "qgsmessagelog.h"
26 #include "qgspointxy.h"
27 #include "qgsproject.h"
28 #include "qgsrelationmanager.h"
30 #include "qgscoordinateformatter.h"
31 #include "qgsvectorlayer.h"
32 #include "qgsunittypes.h"
33 
34 #include "qgsquickmapcanvasmap.h"
35 #include "qgsquickmapsettings.h"
36 #include "qgsquickmaptransform.h"
37 #include "qgsquickplugin.h"
38 
39 void QgsQuickPlugin::registerTypes( const char *uri )
40 {
41  qRegisterMetaType< QList<QgsMapLayer *> >( "QList<QgsMapLayer*>" );
42  qRegisterMetaType< QgsAttributes > ( "QgsAttributes" );
43  qRegisterMetaType< QgsCoordinateReferenceSystem >( "QgsCoordinateReferenceSystem" );
44  qRegisterMetaType< QgsCoordinateTransformContext >( "QgsCoordinateTransformContext" );
45  qRegisterMetaType< QgsFeature > ( "QgsFeature" );
46  qRegisterMetaType< QgsFeatureId > ( "QgsFeatureId" );
47  qRegisterMetaType< QgsPoint >( "QgsPoint" );
48  qRegisterMetaType< QgsPointXY >( "QgsPointXY" );
49  qRegisterMetaType< QgsUnitTypes::SystemOfMeasurement >( "QgsUnitTypes::SystemOfMeasurement" );
50  qRegisterMetaType< QgsUnitTypes::DistanceUnit >( "QgsUnitTypes::DistanceUnit" );
51  qRegisterMetaType< QgsCoordinateFormatter::FormatFlags >( "QgsCoordinateFormatter::FormatFlags" );
52  qRegisterMetaType< QgsCoordinateFormatter::Format >( "QgsCoordinateFormatter::Format" );
53  qRegisterMetaType< QVariant::Type >( "QVariant::Type" );
54 
55  qmlRegisterUncreatableType< QgsUnitTypes >( uri, 0, 1, "QgsUnitTypes", "Only enums from QgsUnitTypes can be used" );
56  qmlRegisterType< QgsProject >( uri, 0, 1, "Project" );
57  qmlRegisterType< QgsQuickMapCanvasMap >( uri, 0, 1, "MapCanvasMap" );
58  qmlRegisterType< QgsQuickMapSettings >( uri, 0, 1, "MapSettings" );
59  qmlRegisterType< QgsQuickMapTransform >( uri, 0, 1, "MapTransform" );
60  qmlRegisterType< QgsVectorLayer >( uri, 0, 1, "VectorLayer" );
61 }
void registerTypes(const char *uri)
Registers the QGIS QML types in the given uri.