-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqgisapp.h
2758 lines (2255 loc) · 99.1 KB
/
qgisapp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************
qgisapp.h - description
-------------------
begin : Sat Jun 22 2002
copyright : (C) 2002 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGISAPP_H
#define QGISAPP_H
class QActionGroup;
class QCheckBox;
class QCursor;
class QFileInfo;
class QKeyEvent;
class QLabel;
class QMenu;
class QPixmap;
class QProgressBar;
class QPushButton;
class QRect;
class QgsSettings;
class QSpinBox;
class QSplashScreen;
class QToolButton;
class QTcpSocket;
class QValidator;
class QgisAppInterface;
class QgisAppStyleSheet;
class QgsAnnotation;
class QgsMapCanvasAnnotationItem;
class QgsAuthManager;
class QgsBookmarks;
class QgsClipboard;
class QgsComposer;
class QgsComposition;
class QgsComposerManager;
class QgsContrastEnhancement;
class QgsCoordinateReferenceSystem;
class QgsCustomDropHandler;
class QgsCustomProjectOpenHandler;
class QgsCustomLayerOrderWidget;
class QgsDockWidget;
class QgsDoubleSpinBox;
class QgsFeature;
class QgsFeatureStore;
class QgsGeometry;
class QgsLayerTreeMapCanvasBridge;
class QgsLayerTreeView;
class QgsLayout;
class QgsMasterLayoutInterface;
class QgsLayoutCustomDropHandler;
class QgsLayoutDesignerDialog;
class QgsLayoutDesignerInterface;
class QgsMapCanvas;
class QgsMapCanvasDockWidget;
class QgsMapLayer;
class QgsMapLayerConfigWidgetFactory;
class QgsMapOverviewCanvas;
class QgsMapTip;
class QgsMapTool;
class QgsMapToolsDigitizingTechniqueManager;
class QgsOptions;
class QgsPluginLayer;
class QgsPluginManager;
class QgsPointCloudLayer;
class QgsPointXY;
class QgsPrintLayout;
class QgsProviderRegistry;
class QgsProviderSublayerDetails;
class QgsPythonUtils;
class QgsRasterLayer;
class QgsRectangle;
class QgsRuntimeProfiler;
class QgsSnappingUtils;
class QgsSnappingWidget;
class QgsStatusBarCoordinatesWidget;
class QgsStatusBarMagnifierWidget;
class QgsStatusBarScaleWidget;
class QgsTaskManagerStatusBarWidget;
class QgsTransactionGroup;
class QgsUndoWidget;
class QgsUserInputWidget;
class QgsVectorLayer;
class QgsVectorLayerTools;
class QgsVectorTileLayer;
class QgsWelcomePage;
class QgsOptionsWidgetFactory;
class QgsStatusBar;
class QgsGeometryValidationService;
class QgsGeometryValidationDock;
class QgsGeometryValidationModel;
class QgsUserProfileManager;
class QgsHandleBadLayersHandler;
class QgsNetworkAccessManager;
class QgsGpsConnection;
class QgsApplicationExitBlockerInterface;
class QgsAbstractMapToolHandler;
class QgsAppMapTools;
class QgsMapToolIdentifyAction;
class Qgs3DMapCanvasWidget;
class QgsVertexEditor;
class QgsMapLayerActionContext;
class QDomDocument;
class QNetworkReply;
class QNetworkProxy;
class QAuthenticator;
class QgsBrowserDockWidget;
class QgsAdvancedDigitizingDockWidget;
class QgsGpsInformationWidget;
class QgsGpsCanvasBridge;
class QgsAppGpsDigitizing;
class QgsAppGpsLogging;
class QgsStatisticalSummaryDockWidget;
class QgsMapCanvasTracer;
class QgsTemporalControllerDockWidget;
class QgsMapDecoration;
class QgsDecorationItem;
class QgsMessageLogViewer;
class QgsMessageBar;
class QgsMessageBarItem;
class QgsDataItem;
class QgsTileScaleWidget;
class QgsLabelingWidget;
class QgsLayerStylingWidget;
class QgsDiagramProperties;
class QgsLocatorWidget;
class QgsNominatimGeocoder;
class QgsDataSourceManagerDialog;
class QgsBrowserGuiModel;
class QgsBrowserModel;
class QgsLayoutCustomDropHandler;
class QgsProxyProgressTask;
class QgsNetworkRequestParameters;
class QgsBearingNumericFormat;
class QgsDevToolsPanelWidget;
class QgsDevToolWidgetFactory;
class QgsNetworkLogger;
class QgsNetworkLoggerWidgetFactory;
class QgsAppQueryLogger;
class QgsMapToolCapture;
class QgsElevationProfileWidget;
class QgsScreenHelper;
class QgsAppGpsConnection;
class QgsGpsToolBar;
class QgsAppGpsSettingsMenu;
class Qgs3DMapScene;
#include <QMainWindow>
#include <QToolBar>
#include <QAbstractSocket>
#include <QPointer>
#include <QSslError>
#include <QDateTime>
#include <QStackedWidget>
#include "qgsauthmanager.h"
#include "qgsconfig.h"
#include "qgspointxy.h"
#include "qgsmimedatautils.h"
#include "qgsrecentprojectsitemsmodel.h"
#include "qgsrasterminmaxorigin.h"
#include "qgslayertreeregistrybridge.h"
#include "qgsmaplayeractionregistry.h"
#include "qgsoptionswidgetfactory.h"
#include "qgsattributetablefiltermodel.h"
#include "qgsmasterlayoutinterface.h"
#include "qgsmaptoolselect.h"
#include "qgsvectorlayersaveasdialog.h"
#include "qgis.h"
#include "ui_qgisapp.h"
#include "qgis_app.h"
#include "qgsappdevtoolutils.h"
#include "qgsoptionsutils.h"
#include <QGestureEvent>
#include <QTapAndHoldGesture>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
class QgsLegendFilterButton;
#ifdef HAVE_GEOREFERENCER
class QgsGeoreferencerMainWindow;
#endif
/**
* \class QgisApp
* \brief Main window for the QGIS application
*/
class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
{
Q_OBJECT
public:
//! Constructor
QgisApp( QSplashScreen *splash, bool restorePlugins = true, bool skipBadLayers = false,
bool skipVersionCheck = false, const QString &rootProfileLocation = QString(),
const QString &activeProfile = QString(),
QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Window );
//! Constructor for unit tests
QgisApp();
~QgisApp() override;
QgisApp( QgisApp const & ) = delete;
QgisApp &operator=( QgisApp const & ) = delete;
/**
* Returns and adjusted uri for the layer based on current and available CRS as well as the last selected image format
* \since QGIS 2.8
*/
QString crsAndFormatAdjustedLayerUri( const QString &uri, const QStringList &supportedCrs, const QStringList &supportedFormats ) const;
//! Sets the extents of the map canvas
void setExtent( const QgsRectangle &rect );
/**
* Open the specified project file; prompt to save previous project if necessary.
* Used to process a commandline argument, FileOpen or Drop event.
*/
void openProject( const QString &fileName );
/**
* Opens a layout template file and creates a new layout designer window for it.
*/
void openTemplate( const QString &fileName );
/**
* Attempts to run a Python script
* \param filePath full path to Python script
*/
void runScript( const QString &filePath );
/**
* Opens a QGIS project file
* \returns FALSE if unable to open the project
*/
bool addProject( const QString &projectFile );
//!Overloaded version of the private function with same name that takes the imagename as a parameter
void saveMapAsImage( const QString &, QPixmap * );
//! Gets the mapcanvas object from the app
QgsMapCanvas *mapCanvas();
/**
* Returns a list of all map canvases open in the app.
*/
QList< QgsMapCanvas * > mapCanvases();
/**
* Returns the 2D map canvas dock widget named \a name
*/
QgsMapCanvasDockWidget *getMapCanvas( const QString &name );
/**
* Returns a map of all 3D map scenes (by name) open in the app.
*/
QMap<QString, Qgs3DMapScene *> map3DScenes();
/**
* Create a new map canvas with the specified unique \a name.
*/
QgsMapCanvas *createNewMapCanvas( const QString &name );
/**
* Create a new map canvas dock widget with the specified unique \a name.
* \note the mapCanvas() inside the dock widget will initially be frozen to avoid multiple
* unwanted map redraws. Callers must manually unfreeze the map canvas when they have finished
* setting the initial state of the canvas and are ready for it to begin rendering.
*/
QgsMapCanvasDockWidget *createNewMapCanvasDock( const QString &name, bool isDocked = true );
/**
* Closes the additional map canvas with matching \a name.
*/
void closeMapCanvas( const QString &name );
/**
* Closes any additional map canvases. The main map canvas will not
* be affected.
*/
void closeAdditionalMapCanvases();
/**
* Freezes all map canvases (or thaws them if the \a frozen argument is FALSE).
*/
void freezeCanvases( bool frozen = true );
//! Returns the messageBar object which allows displaying unobtrusive messages to the user.
QgsMessageBar *messageBar();
//! Open the message log dock widget
void openMessageLog();
//! Adds a widget to the user input tool bar
void addUserInputWidget( QWidget *widget );
//! Sets theme (icons)
void setTheme( const QString &themeName = "default" );
void setIconSizes( int size );
//! Gets stylesheet builder object for app and layout designers
QgisAppStyleSheet *styleSheetBuilder();
//! Populates a menu with actions for opening layout designers
void populateLayoutsMenu( QMenu *menu );
//! Populates a menu with actions for 3D views
void populate3DMapviewsMenu( QMenu *menu );
//! Setup the toolbar popup menus for a given theme
void setupToolbarPopups( QString themeName );
//! Returns a pointer to the internal clipboard
QgsClipboard *clipboard();
static QgisApp *instance() { return sInstance; }
//! initialize network manager
void namSetup();
//! update proxy settings
void namUpdate();
//! Sets up master password
void masterPasswordSetup();
/**
* Add a dock widget to the main window. Overloaded from QMainWindow.
* After adding the dock widget to the ui (by delegating to the QMainWindow
* parent class, it will also add it to the View menu list of docks.
*/
void addDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget );
void removeDockWidget( QDockWidget *dockwidget );
/**
* Add a dock widget to the given area and tabify it (if other dock widgets
* exist in the same \a area). The new tab will be below other tabs unless
* \a raiseTab is passed as TRUE.
*
* \a tabifyWith is a list of dock widget object names, ordered by
* priority, with which the new dock widget should be tabified. Only the
* first matching object name will be picked. If none of the given object
* names is found in that \a area (or if \a tabifyWith is not given at
* all), the new dock widget will be created anyways, but its location
* within that \a area will be unpredictable.
*
* \since QGIS 3.14
*/
void addTabifiedDockWidget( Qt::DockWidgetArea area, QDockWidget *dockWidget, const QStringList &tabifyWith = QStringList(), bool raiseTab = false );
/**
* Add a toolbar to the main window. Overloaded from QMainWindow.
* After adding the toolbar to the ui (by delegating to the QMainWindow
* parent class, it will also add it to the View menu list of toolbars.
*/
QToolBar *addToolBar( const QString &name );
/**
* Add a toolbar to the main window. Overloaded from QMainWindow.
* After adding the toolbar to the ui (by delegating to the QMainWindow
* parent class, it will also add it to the View menu list of toolbars.
* \since QGIS 2.3
*/
void addToolBar( QToolBar *toolBar, Qt::ToolBarArea area = Qt::TopToolBarArea );
/**
* Add window to Window menu. The action title is the window title
* and the action should raise, unminimize and activate the window.
*/
void addWindow( QAction *action );
/**
* Remove window from Window menu. Calling this is necessary only for
* windows which are hidden rather than deleted when closed.
*/
void removeWindow( QAction *action );
/**
* Returns the active layout designers.
*/
QSet<QgsLayoutDesignerDialog *> layoutDesigners() const { return mLayoutDesignerDialogs; }
/**
* Gets a unique title from user for new and duplicate layouts.
*
* The \a title argument will be filled with the new layout title.
*
* If \a acceptEmpty is TRUE then empty titles will be acceptable (one will be generated).
*
* The \a currentTitle argument specifies a base name for initial title choice.
*
* \returns TRUE if user did not cancel the dialog.
*/
bool uniqueLayoutTitle( QWidget *parent, QString &title, bool acceptEmpty, QgsMasterLayoutInterface::Type type, const QString ¤tTitle = QString() );
/**
* Creates a new print layout, opens a designer for it and returns a pointer to
* designer dialog.
*
* If \a title is specified it will be used as the name for the new print layout,
* otherwise the user will be prompted to enter a name for the layout.
*/
QgsLayoutDesignerDialog *createNewPrintLayout( const QString &title = QString() );
//! Creates a new report and returns a pointer to it
QgsLayoutDesignerDialog *createNewReport( QString title = QString() );
/**
* Opens a layout designer dialog for an existing \a layout.
* If a designer already exists for this layout then it will be activated.
*/
QgsLayoutDesignerDialog *openLayoutDesignerDialog( QgsMasterLayoutInterface *layout );
/**
* Opens a 3D view canvas for a 3D map view called \a name.
* If the 3D view named \a name was not already created in the project, nullptr will be returned
*
* \since QGIS 3.24
*/
Qgs3DMapCanvasWidget *open3DMapView( const QString &name );
/**
* Close the 3D view canvas of 3D map view called \a name.
*
* \since QGIS 3.24
*/
void close3DMapView( const QString &name );
/**
* Duplicates the 3D map view named \a existingViewName and adds it to the current project.
* The new 3D map view will be named \a newViewName
*
* \since QGIS 3.24
*/
Qgs3DMapCanvasWidget *duplicate3DMapView( const QString &existingViewName, const QString &newViewName );
/**
* Returns the 3D map canvas dock widget named \a viewName
*
* \since QGIS 3.24
*/
Qgs3DMapCanvasWidget *get3DMapView( const QString &viewName );
/**
* Returns the list of 3D map canvas dockable widgets created
*
* \since QGIS 3.24
*/
QList<Qgs3DMapCanvasWidget *> get3DMapViews();
/**
* Duplicates a \a layout and adds it to the current project.
*
* If \a title is set, it will be used as the title for the new layout. If it is not set,
* and auto-generated title will be used instead.
*/
QgsLayoutDesignerDialog *duplicateLayout( QgsMasterLayoutInterface *layout, const QString &title = QString() );
//! Overloaded function used to sort menu entries alphabetically
QMenu *createPopupMenu() override;
/**
* Access the vector layer tools. This will be an instance of {\see QgsGuiVectorLayerTools}
* by default.
* \returns The vector layer tools
*/
QgsVectorLayerTools *vectorLayerTools() { return mVectorLayerTools; }
/**
* Notify the user by using the system tray notifications
*
* \note usage of the system tray notifications should be limited
* to long running tasks and to when the user needs to be notified
* about interaction with OS services, like the password manager.
*
* \param title
* \param message
* \param replaceExisting set to TRUE to replace any existing notifications, or FALSE to add a new notification
*/
void showSystemNotification( const QString &title, const QString &message, bool replaceExisting = true );
//! Actions to be inserted in menus and toolbars
QAction *actionNewProject() { return mActionNewProject; }
QAction *actionOpenProject() { return mActionOpenProject; }
QAction *actionSaveProject() { return mActionSaveProject; }
QAction *actionSaveProjectAs() { return mActionSaveProjectAs; }
QAction *actionSaveMapAsImage() { return mActionSaveMapAsImage; }
QAction *actionSaveMapAsPdf() { return mActionSaveMapAsPdf; }
QAction *actionProjectProperties() { return mActionProjectProperties; }
QAction *actionShowLayoutManager() { return mActionShowLayoutManager; }
QAction *actionNewPrintLayout() { return mActionNewPrintLayout; }
QAction *actionExit() { return mActionExit; }
QAction *actionCutFeatures() { return mActionCutFeatures; }
QAction *actionCopyFeatures() { return mActionCopyFeatures; }
QAction *actionPasteFeatures() { return mActionPasteFeatures; }
QAction *actionPasteAsNewVector() { return mActionPasteAsNewVector; }
QAction *actionPasteAsNewMemoryVector() { return mActionPasteAsNewMemoryVector; }
QAction *actionDeleteSelected() { return mActionDeleteSelected; }
QAction *actionAddFeature() { return mActionAddFeature; }
QAction *actionMoveFeature() { return mActionMoveFeature; }
QAction *actionMoveFeatureCopy() { return mActionMoveFeatureCopy; }
QAction *actionRotateFeature() { return mActionRotateFeature;}
QAction *actionScaleFeature() { return mActionScaleFeature;}
QAction *actionSplitFeatures() { return mActionSplitFeatures; }
QAction *actionSplitParts() { return mActionSplitParts; }
QAction *actionAddRing() { return mActionAddRing; }
QAction *actionFillRing() { return mActionFillRing; }
QAction *actionAddPart() { return mActionAddPart; }
QAction *actionSimplifyFeature() { return mActionSimplifyFeature; }
QAction *actionDeleteRing() { return mActionDeleteRing; }
QAction *actionDeletePart() { return mActionDeletePart; }
QAction *actionVertexTool() { return mActionVertexTool; }
QAction *actionVertexToolActiveLayer() { return mActionVertexToolActiveLayer; }
QAction *actionSnappingOptions() { return mActionSnappingOptions; }
QAction *actionOffsetCurve() { return mActionOffsetCurve; }
QAction *actionPan() { return mActionPan; }
QAction *actionPanToSelected() { return mActionPanToSelected; }
QAction *actionZoomIn() { return mActionZoomIn; }
QAction *actionZoomOut() { return mActionZoomOut; }
QAction *actionSelect() { return mActionSelectFeatures; }
QAction *actionSelectRectangle() { return mActionSelectFeatures; }
QAction *actionSelectPolygon() { return mActionSelectPolygon; }
QAction *actionSelectFreehand() { return mActionSelectFreehand; }
QAction *actionSelectRadius() { return mActionSelectRadius; }
QAction *actionIdentify() { return mActionIdentify; }
QAction *actionFeatureAction() { return mActionFeatureAction; }
QAction *actionMeasure() { return mActionMeasure; }
QAction *actionMeasureArea() { return mActionMeasureArea; }
QAction *actionZoomFullExtent() { return mActionZoomFullExtent; }
QAction *actionZoomToLayer() { return mActionZoomToLayer; }
QAction *actionZoomToLayers() { return mActionZoomToLayers; }
QAction *actionZoomToSelected() { return mActionZoomToSelected; }
QAction *actionZoomLast() { return mActionZoomLast; }
QAction *actionZoomNext() { return mActionZoomNext; }
QAction *actionZoomActualSize() { return mActionZoomActualSize; }
QAction *actionMapTips() { return mActionMapTips; }
QAction *actionNewBookmark() { return mActionNewBookmark; }
QAction *actionShowBookmarks() { return mActionShowBookmarks; }
QAction *actionShowBookmarkManager() { return mActionShowBookmarkManager; }
QAction *actionDraw() { return mActionDraw; }
QAction *actionDataSourceManager() { return mActionDataSourceManager; }
QAction *actionNewVectorLayer() { return mActionNewVectorLayer; }
#ifdef HAVE_SPATIALITE
QAction *actionNewSpatialLiteLayer() { return mActionNewSpatiaLiteLayer; }
#else
QAction *actionNewSpatialLiteLayer() { return nullptr; }
#endif
QAction *actionEmbedLayers() { return mActionEmbedLayers; }
QAction *actionAddOgrLayer() { return mActionAddOgrLayer; }
QAction *actionAddRasterLayer() { return mActionAddRasterLayer; }
QAction *actionAddPgLayer() { return mActionAddPgLayer; }
#ifdef HAVE_SPATIALITE
QAction *actionAddSpatiaLiteLayer() { return mActionAddSpatiaLiteLayer; }
#else
QAction *actionAddSpatiaLiteLayer() { return nullptr; }
#endif
QAction *actionAddWmsLayer() { return mActionAddWmsLayer; }
QAction *actionAddXyzLayer() { return mActionAddXyzLayer; }
QAction *actionAddVectorTileLayer() { return mActionAddVectorTileLayer; }
QAction *actionAddPointCloudLayer() { return mActionAddPointCloudLayer; }
QAction *actionAddGpsLayer() { return mActionAddGpsLayer; }
QAction *actionAddWcsLayer() { return mActionAddWcsLayer; }
#ifdef HAVE_SPATIALITE
QAction *actionAddWfsLayer() { return mActionAddWfsLayer; }
#else
QAction *actionAddWfsLayer() { return nullptr; }
#endif
QAction *actionAddAfsLayer() { return mActionAddAfsLayer; }
QAction *actionCopyLayerStyle() { return mActionCopyStyle; }
QAction *actionPasteLayerStyle() { return mActionPasteStyle; }
QAction *actionOpenTable() { return mActionOpenTable; }
QAction *actionOpenFieldCalculator() { return mActionOpenFieldCalc; }
QAction *actionStatisticalSummary() { return mActionStatisticalSummary; }
QAction *actionToggleEditing() { return mActionToggleEditing; }
QAction *actionSaveActiveLayerEdits() { return mActionSaveLayerEdits; }
QAction *actionAllEdits() { return mActionAllEdits; }
QAction *actionSaveEdits() { return mActionSaveEdits; }
QAction *actionSaveAllEdits() { return mActionSaveAllEdits; }
QAction *actionRollbackEdits() { return mActionRollbackEdits; }
QAction *actionRollbackAllEdits() { return mActionRollbackAllEdits; }
QAction *actionCancelEdits() { return mActionCancelEdits; }
QAction *actionCancelAllEdits() { return mActionCancelAllEdits; }
QAction *actionLayerSaveAs() { return mActionLayerSaveAs; }
QAction *actionRemoveLayer() { return mActionRemoveLayer; }
QAction *actionDuplicateLayer() { return mActionDuplicateLayer; }
//! \since QGIS 2.4
QAction *actionSetLayerScaleVisibility() { return mActionSetLayerScaleVisibility; }
QAction *actionSetLayerCrs() { return mActionSetLayerCRS; }
QAction *actionSetProjectCrsFromLayer() { return mActionSetProjectCRSFromLayer; }
QAction *actionLayerProperties() { return mActionLayerProperties; }
QAction *actionLayerSubsetString() { return mActionLayerSubsetString; }
QAction *actionAddToOverview() { return mActionAddToOverview; }
QAction *actionAddAllToOverview() { return mActionAddAllToOverview; }
QAction *actionRemoveAllFromOverview() { return mActionRemoveAllFromOverview; }
QAction *actionHideAllLayers() { return mActionHideAllLayers; }
QAction *actionShowAllLayers() { return mActionShowAllLayers; }
QAction *actionHideSelectedLayers() { return mActionHideSelectedLayers; }
QAction *actionToggleSelectedLayers() { return mActionToggleSelectedLayers; }
QAction *actionToggleSelectedLayersIndependently() { return mActionToggleSelectedLayersIndependently; }
QAction *actionHideDeselectedLayers() { return mActionHideDeselectedLayers; }
QAction *actionShowSelectedLayers() { return mActionShowSelectedLayers; }
QAction *actionManagePlugins() { return mActionManagePlugins; }
QAction *actionPluginListSeparator() { return mActionPluginSeparator1; }
QAction *actionPluginPythonSeparator() { return mActionPluginSeparator2; }
QAction *actionShowPythonDialog() { return mActionShowPythonDialog; }
QAction *actionToggleFullScreen() { return mActionToggleFullScreen; }
QAction *actionTogglePanelsVisibility() { return mActionTogglePanelsVisibility; }
QAction *actionToggleMapOnly() { return mActionToggleMapOnly; }
QAction *actionOptions() { return mActionOptions; }
QAction *actionCustomProjection() { return mActionCustomProjection; }
QAction *actionConfigureShortcuts() { return mActionConfigureShortcuts; }
#ifdef Q_OS_MAC
QAction *actionWindowMinimize() { return mActionWindowMinimize; }
QAction *actionWindowZoom() { return mActionWindowZoom; }
QAction *actionWindowAllToFront() { return mActionWindowAllToFront; }
#endif
QAction *actionHelpContents() { return mActionHelpContents; }
QAction *actionHelpAPI() { return mActionHelpAPI; }
QAction *actionHelpPyQgisAPI() { return mActionHelpPyQgisAPI; }
QAction *actionReportaBug() { return mActionReportaBug; }
QAction *actionQgisHomePage() { return mActionQgisHomePage; }
QAction *actionCheckQgisVersion() { return mActionCheckQgisVersion; }
QAction *actionAbout() { return mActionAbout; }
QAction *actionSponsors() { return mActionSponsors; }
QAction *actionShowPinnedLabels() { return mActionShowPinnedLabels; }
//! Menus
QMenu *projectMenu() { return mProjectMenu; }
QMenu *projectImportExportMenu() { return menuImport_Export; }
QMenu *editMenu() { return mEditMenu; }
QMenu *viewMenu() { return mViewMenu; }
QMenu *layerMenu() { return mLayerMenu; }
QMenu *newLayerMenu() { return mNewLayerMenu; }
//! \since QGIS 2.5
QMenu *addLayerMenu() { return mAddLayerMenu; }
QMenu *settingsMenu() { return mSettingsMenu; }
QMenu *pluginMenu() { return mPluginMenu; }
QMenu *pluginHelpMenu() { return mMenuPluginHelp; }
QMenu *databaseMenu() { return mDatabaseMenu; }
QMenu *rasterMenu() { return mRasterMenu; }
QMenu *vectorMenu() { return mVectorMenu; }
QMenu *meshMenu() { return mMeshMenu; }
QMenu *webMenu() { return mWebMenu; }
#ifdef Q_OS_MAC
QMenu *firstRightStandardMenu() { return mWindowMenu; }
QMenu *windowMenu() { return mWindowMenu; }
#else
QMenu *firstRightStandardMenu() { return mHelpMenu; }
QMenu *windowMenu() { return nullptr; }
#endif
QMenu *helpMenu() { return mHelpMenu; }
//! Toolbars
/**
* Gets a reference to a toolbar. Mainly intended
* to be used by plugins that want to specifically add
* an icon into the file toolbar for consistency e.g.
* addWFS and GPS plugins.
*/
QToolBar *fileToolBar() { return mFileToolBar; }
QToolBar *layerToolBar() { return mLayerToolBar; }
QToolBar *dataSourceManagerToolBar() { return mDataSourceManagerToolBar; }
QToolBar *mapNavToolToolBar() { return mMapNavToolBar; }
QToolBar *digitizeToolBar() { return mDigitizeToolBar; }
QToolBar *advancedDigitizeToolBar() { return mAdvancedDigitizeToolBar; }
QToolBar *shapeDigitizeToolBar() { return mShapeDigitizeToolBar; }
QToolBar *attributesToolBar() { return mAttributesToolBar; }
/**
* Returns selection toolbar
* \since QGIS 3.14
*/
QToolBar *selectionToolBar() { return mSelectionToolBar; }
QToolBar *pluginToolBar() { return mPluginToolBar; }
QToolBar *helpToolBar() { return mHelpToolBar; }
QToolBar *rasterToolBar() { return mRasterToolBar; }
QToolBar *vectorToolBar() { return mVectorToolBar; }
QToolBar *meshToolBar() {return mMeshToolBar;}
QToolBar *databaseToolBar() { return mDatabaseToolBar; }
QToolBar *webToolBar() { return mWebToolBar; }
QgsStatusBar *statusBarIface() { return mStatusBar; }
//! Returns the CAD dock widget
QgsAdvancedDigitizingDockWidget *cadDockWidget() { return mAdvancedDigitizingDockWidget; }
//! Returns map overview canvas
QgsMapOverviewCanvas *mapOverviewCanvas() { return mOverviewCanvas; }
QgsLocatorWidget *locatorWidget() { return mLocatorWidget; }
//! show layer properties
void showLayerProperties( QgsMapLayer *mapLayer, const QString &page = QString() );
//! returns pointer to map legend
QgsLayerTreeView *layerTreeView();
QgsLayerTreeMapCanvasBridge *layerTreeCanvasBridge() { return mLayerTreeCanvasBridge; }
//! returns pointer to plugin manager
QgsPluginManager *pluginManager();
/**
* The applications user profile manager.
*/
QgsUserProfileManager *userProfileManager();
/**
* Returns the vector layers in edit mode
* \param modified whether to return only layers that have been modified
* \returns list of layers in legend order, or empty list
*/
QList<QgsMapLayer *> editableLayers( bool modified = false, bool ignoreLayersWhichCannotBeToggled = false ) const;
//! emit initializationCompleted signal
void completeInitialization();
void emitCustomCrsValidation( QgsCoordinateReferenceSystem &crs );
/**
* Returns a list of active map decorations
* \since QGIS 3.14
*/
QList<QgsMapDecoration *> activeDecorations();
//! Returns a list of registered map decoration items
QList<QgsDecorationItem *> decorationItems() { return mDecorationItems; }
//! A a map decoration \a item
void addDecorationItem( QgsDecorationItem *item ) { mDecorationItems.append( item ); }
//! \since QGIS 2.1
static QString normalizedMenuName( const QString &name );
void parseVersionInfo( QNetworkReply *reply, int &latestVersion, QStringList &versionInfo );
//! Register a new tab in the layer properties dialog
void registerMapLayerPropertiesFactory( QgsMapLayerConfigWidgetFactory *factory );
//! Unregister a previously registered tab in the layer properties dialog
void unregisterMapLayerPropertiesFactory( QgsMapLayerConfigWidgetFactory *factory );
//! Register a new tab in the options dialog
void registerOptionsWidgetFactory( QgsOptionsWidgetFactory *factory );
//! Unregister a previously registered tab in the options dialog
void unregisterOptionsWidgetFactory( QgsOptionsWidgetFactory *factory );
//! Register a new tab in the project properties dialog
void registerProjectPropertiesWidgetFactory( QgsOptionsWidgetFactory *factory );
//! Unregister a previously registered tab in the project properties dialog
void unregisterProjectPropertiesWidgetFactory( QgsOptionsWidgetFactory *factory );
//! Register a dev tool factory
void registerDevToolFactory( QgsDevToolWidgetFactory *factory );
//! Unregister a previously registered dev tool factory
void unregisterDevToolFactory( QgsDevToolWidgetFactory *factory );
/**
* Register a new application exit blocker, which can be used to prevent the QGIS application
* from exiting while a plugin or script has unsaved changes.
*
* \note Ownership of \a blocker is not transferred, and the blocker must
* be unregistered when plugin is unloaded.
*
* \see unregisterApplicationExitBlocker()
*/
void registerApplicationExitBlocker( QgsApplicationExitBlockerInterface *blocker );
/**
* Unregister a previously registered application exit \a blocker.
* \see registerApplicationExitBlocker()
*/
void unregisterApplicationExitBlocker( QgsApplicationExitBlockerInterface *blocker );
/**
* Register a new application map tool \a handler, which can be used to automatically setup all connections
* and logic required to switch to a custom map tool whenever the state of the QGIS application
* permits.
*
* \note Ownership of \a handler is not transferred, and the handler must
* be unregistered when plugin is unloaded.
*
* \see QgsAbstractMapToolHandler
* \see unregisterMapToolHandler()
*/
void registerMapToolHandler( QgsAbstractMapToolHandler *handler );
/**
* Unregister a previously registered map tool \a handler.
* \see registerMapToolHandler()
*/
void unregisterMapToolHandler( QgsAbstractMapToolHandler *handler );
//! Register a new custom drop handler.
void registerCustomDropHandler( QgsCustomDropHandler *handler );
//! Unregister a previously registered custom drop handler.
void unregisterCustomDropHandler( QgsCustomDropHandler *handler );
/**
* Register a new custom project open \a handler.
* \note Ownership of \a handler is not transferred, and the handler must
* be unregistered when plugin is unloaded.
* \see QgsCustomProjectOpenHandler
* \see unregisterCustomProjectOpenHandler()
*/
void registerCustomProjectOpenHandler( QgsCustomProjectOpenHandler *handler );
/**
* Unregister a previously registered custom project open \a handler.
* \see QgsCustomDropHandler
* \see registerCustomProjectOpenHandler()
*/
void unregisterCustomProjectOpenHandler( QgsCustomProjectOpenHandler *handler );
//! Returns a list of registered custom drop handlers.
QVector<QPointer<QgsCustomDropHandler >> customDropHandlers() const;
//! Register a new custom layout drop handler.
void registerCustomLayoutDropHandler( QgsLayoutCustomDropHandler *handler );
//! Unregister a previously registered custom layout drop handler.
void unregisterCustomLayoutDropHandler( QgsLayoutCustomDropHandler *handler );
//! Returns a list of registered custom layout drop handlers.
QVector<QPointer<QgsLayoutCustomDropHandler >> customLayoutDropHandlers() const;
//! Returns the active map layer.
QgsMapLayer *activeLayer();
/**
* Returns the toolbar icon size. If \a dockedToolbar is TRUE, the icon size
* for toolbars contained within docks is returned.
*/
QSize iconSize( bool dockedToolbar = false ) const;
/**
* Checks available datum transforms and ask user if several are available and none
* is chosen. Dialog is shown only if global option is set accordingly.
* \returns TRUE if a datum transform has been specifically chosen by user or only one is available.
* \since 3.0
*/
bool askUserForDatumTransform( const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, const QgsMapLayer *layer = nullptr );
//! Gets map of bookmarks
QMap<QString, QModelIndex> getBookmarkIndexMap();
//! Zoom to a bookmark
void zoomToBookmarkIndex( const QModelIndex & );
//! Returns pointer to the identify map tool - used by identify tool in 3D view
QgsMapToolIdentifyAction *identifyMapTool() const;
QgsMapLayerActionContext createMapLayerActionContext();
/**
* Take screenshots for user documentation
* @param saveDirectory path were the screenshots will be saved
* @param categories an int as a flag value of QgsAppScreenShots::Categories
*/
void takeAppScreenShots( const QString &saveDirectory, const int categories = 0 );
QgsLayerTreeRegistryBridge::InsertionPoint layerTreeInsertionPoint() const;
/**
* Sets a GPS \a connection to use within the GPS Panel widget.
*
* Any existing GPS connection used by the widget will be disconnect and replaced with this connection. The connection
* is automatically registered within the QgsApplication::gpsConnectionRegistry().
*/
void setGpsPanelConnection( QgsGpsConnection *connection );
/**
* Returns the GPS settings menu;
*/
QgsAppGpsSettingsMenu *gpsSettingsMenu();
//! Returns the application vertex editor
QgsVertexEditor *vertexEditor() { return mVertexEditorDock; }
public slots:
//! save current vector layer
QString saveAsFile( QgsMapLayer *layer = nullptr, bool onlySelected = false, bool defaultToAddToMap = true );
/**
* Makes a memory layer permanent, by prompting users to save the layer to a disk-based (OGR)
* format, and then replacing the layer's data source in place.
*/
void makeMemoryLayerPermanent( QgsVectorLayer *layer );
//! save qml style for the current layer
void saveStyleFile( QgsMapLayer *layer = nullptr );
//! save qrl definition for the current layer
void saveAsLayerDefinition();
//! save current raster layer
QString saveAsRasterFile( QgsRasterLayer *layer = nullptr, bool defaultAddToCanvas = true );
/**
* Process the list of URIs that have been dropped in QGIS.
*
* Returns a list of layers loaded as a result of opening the URIs.
*/
QList< QgsMapLayer * > handleDropUriList( const QgsMimeDataUtils::UriList &lst, bool suppressBulkLayerPostProcessing = false, bool addToLegend = true );
/**
* Convenience function to open either a project or a layer file.
*
* Returns a list of layers loaded as a result of opening the file.
*/
QList< QgsMapLayer * > openFile( const QString &fileName, const QString &fileTypeHint = QString(), bool suppressBulkLayerPostProcessing = false, bool addToLegend = true );
void layerTreeViewDoubleClicked( const QModelIndex &index );
//! Make sure the insertion point for new layers is up-to-date with the current item in layer tree view
void updateNewLayerInsertionPoint();
//! connected to layer tree registry bridge, selects first of the newly added map layers
void autoSelectAddedLayer( QList<QgsMapLayer *> layers );
//! Zoom to full extent
void zoomFull();
//! Zoom to the previous extent
void zoomToPrevious();
//! Zoom to the forward extent
void zoomToNext();
//! Zoom to selected features
void zoomToSelected();
//! Pan map to selected features
void panToSelected();
//! open the properties dialog for the currently selected layer
void layerProperties();
//! show the attribute table for the currently selected layer
void attributeTable( QgsAttributeTableFilterModel::FilterMode filter = QgsAttributeTableFilterModel::ShowAll, const QString &filterExpression = QString() );
void fieldCalculator();
//! mark project dirty
void markDirty();
/**
* \brief layersWereAdded is triggered when layers were added
* This method loops through the list of \a layers and connect all
* application signals that need to listen to layer events.
* \param layers list of map layers that have been added
*/
void layersWereAdded( const QList<QgsMapLayer *> &layers );
/* layer will be removed - changed from removingLayer to removingLayers
in 1.8.
*/
void removingLayers( const QStringList & );
//! starts/stops editing mode of the current layer
void toggleEditing();
//! starts/stops editing mode of a layer
bool toggleEditing( QgsMapLayer *layer, bool allowCancel = true );
//! Save edits for active vector layer and start new transactions
void saveActiveLayerEdits();
/**
* Save edits of a layer
* \param leaveEditable leave the layer in editing mode when done
* \param triggerRepaint send layer signal to repaint canvas when done
*/
void saveEdits( QgsMapLayer *layer, bool leaveEditable = true, bool triggerRepaint = true );
/**
* Cancel edits for a layer
* \param leaveEditable leave the layer in editing mode when done