-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqgisapp.h
1888 lines (1563 loc) · 70.5 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 QStringList;
class QToolButton;
class QTcpSocket;
class QValidator;
class QSystemTrayIcon;
class QgisAppInterface;
class QgisAppStyleSheet;
class QgsAnnotation;
class QgsMapCanvasAnnotationItem;
class QgsAuthManager;
class QgsBookmarks;
class QgsClipboard;
class QgsComposer;
class QgsComposerManager;
class QgsComposerView;
class QgsContrastEnhancement;
class QgsCoordinateReferenceSystem;
class QgsCustomDropHandler;
class QgsCustomLayerOrderWidget;
class QgsDockWidget;
class QgsDoubleSpinBox;
class QgsFeature;
class QgsFeatureStore;
class QgsGeometry;
class QgsLayerTreeMapCanvasBridge;
class QgsLayerTreeView;
class QgsMapCanvas;
class QgsMapLayer;
class QgsMapLayerConfigWidgetFactory;
class QgsMapOverviewCanvas;
class QgsMapTip;
class QgsMapTool;
class QgsMapToolAdvancedDigitizing;
class QgsPluginLayer;
class QgsPluginLayer;
class QgsPluginManager;
class QgsPoint;
class QgsProviderRegistry;
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 QgsUserInputDockWidget;
class QgsVectorLayer;
class QgsVectorLayerTools;
class QgsWelcomePage;
class QgsOptionsWidgetFactory;
class QDomDocument;
class QNetworkReply;
class QNetworkProxy;
class QAuthenticator;
class QgsBrowserDockWidget;
class QgsAdvancedDigitizingDockWidget;
class QgsGPSInformationWidget;
class QgsStatisticalSummaryDockWidget;
class QgsMapCanvasTracer;
class QgsDecorationItem;
class QgsMessageLogViewer;
class QgsMessageBar;
class QgsDataItem;
class QgsTileScaleWidget;
class QgsLabelingWidget;
class QgsLayerStylingWidget;
class QgsDiagramProperties;
#include <QMainWindow>
#include <QToolBar>
#include <QAbstractSocket>
#include <QPointer>
#include <QSslError>
#include <QDateTime>
#include <QStackedWidget>
#include "qgsauthmanager.h"
#include "qgsconfig.h"
#include "qgsfeature.h"
#include "qgspoint.h"
#include "qgsmessagebar.h"
#include "qgsmimedatautils.h"
#include "qgswelcomepageitemsmodel.h"
#include "qgsraster.h"
#include "qgsrasterminmaxorigin.h"
#include "ui_qgisapp.h"
#include "qgis_app.h"
#include <QGestureEvent>
#include <QTapAndHoldGesture>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
class QgsLegendFilterButton;
/** \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 skipVersionCheck = false, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Window );
//! Constructor for unit tests
QgisApp();
~QgisApp();
QgisApp( QgisApp const & ) = delete;
QgisApp &operator=( QgisApp const & ) = delete;
/**
* Add a vector layer to the canvas, returns pointer to it
*/
QgsVectorLayer *addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey );
/** \brief overloaded version of the private addLayer method that takes a list of
* file names instead of prompting user with a dialog.
@param enc encoding type for the layer
@param dataSourceType type of ogr datasource
@returns true if successfully added layer
*/
bool addVectorLayers( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType );
/** Overloaded vesion of the private addRasterLayer()
Method that takes a list of file names instead of prompting
user with a dialog.
@returns true if successfully added layer(s)
*/
bool addRasterLayers( const QStringList &layerQStringList, bool guiWarning = true );
/** Open a raster layer for the given file
@returns false if unable to open a raster layer for rasterFile
@note
This is essentially a simplified version of the above
*/
QgsRasterLayer *addRasterLayer( const QString &rasterFile, const QString &baseName, bool guiWarning = true );
/** Returns and adjusted uri for the layer based on current and available CRS as well as the last selected image format
* @note added in 2.8
*/
QString crsAndFormatAdjustedLayerUri( const QString &uri, const QStringList &supportedCrs, const QStringList &supportedFormats ) const;
//! Add a 'pre-made' map layer to the project
void addMapLayer( QgsMapLayer *mapLayer );
//! Set the extents of the map canvas
void setExtent( const QgsRectangle &rect );
//! Remove all layers from the map and legend - reimplements same method from qgisappbase
void removeAllLayers();
/** Open a raster or vector file; ignore other files.
Used to process a commandline argument, FileOpen or Drop event.
Set interactive to true if it is ok to ask the user for information (mostly for
when a vector layer has sublayers and we want to ask which sublayers to use).
@returns true if the file is successfully opened
*/
bool openLayer( const QString &fileName, bool allowInteractive = false );
/** 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 );
void openLayerDefinition( const QString &filename );
//! Open a composer template file and create a new composition
void openTemplate( const QString &fileName );
/** Opens a qgis project file
@returns false if unable to open the project
*/
bool addProject( const QString &projectFile );
/** Convenience function to open either a project or a layer file.
*/
void openFile( const QString &fileName );
//!Overloaded version of the private function with same name that takes the imagename as a parameter
void saveMapAsImage( const QString &, QPixmap * );
//! Get the mapcanvas object from the app
QgsMapCanvas *mapCanvas();
//! Return 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 );
//! Set theme (icons)
void setTheme( const QString &themeName = "default" );
void setIconSizes( int size );
//! Get stylesheet builder object for app and print composers
QgisAppStyleSheet *styleSheetBuilder();
//! 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();
//! set 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 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.
* @note added in 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 print composers
QSet<QgsComposer *> printComposers() const {return mPrintComposers;}
/** Get a unique title from user for new and duplicate composers
* @param acceptEmpty whether to accept empty titles (one will be generated)
* @param currentTitle base name for initial title choice
* @return QString::null if user cancels input dialog
*/
bool uniqueComposerTitle( QWidget *parent, QString &composerTitle, bool acceptEmpty, const QString ¤tTitle = QString() );
//! Creates a new composer and returns a pointer to it
QgsComposer *createNewComposer( QString title = QString() );
//! Deletes a composer and removes entry from Set
void deleteComposer( QgsComposer *c );
/** Duplicates a composer and adds it to Set
*/
QgsComposer *duplicateComposer( QgsComposer *currentComposer, 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.
* @return The vector layer tools
*/
QgsVectorLayerTools *vectorLayerTools() { return mVectorLayerTools; }
//! 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 *actionProjectProperties() { return mActionProjectProperties; }
QAction *actionShowComposerManager() { return mActionShowComposerManager; }
QAction *actionNewPrintComposer() { return mActionNewPrintComposer; }
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 *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 *actionNodeTool() { return mActionNodeTool; }
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 *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 *actionDraw() { return mActionDraw; }
QAction *actionNewVectorLayer() { return mActionNewVectorLayer; }
QAction *actionNewSpatialLiteLayer() { return mActionNewSpatiaLiteLayer; }
QAction *actionEmbedLayers() { return mActionEmbedLayers; }
QAction *actionAddOgrLayer() { return mActionAddOgrLayer; }
QAction *actionAddRasterLayer() { return mActionAddRasterLayer; }
QAction *actionAddPgLayer() { return mActionAddPgLayer; }
QAction *actionAddSpatiaLiteLayer() { return mActionAddSpatiaLiteLayer; }
QAction *actionAddWmsLayer() { return mActionAddWmsLayer; }
QAction *actionAddWcsLayer() { return mActionAddWcsLayer; }
QAction *actionAddWfsLayer() { return mActionAddWfsLayer; }
QAction *actionAddAfsLayer() { return mActionAddAfsLayer; }
QAction *actionAddAmsLayer() { return mActionAddAmsLayer; }
QAction *actionCopyLayerStyle() { return mActionCopyStyle; }
QAction *actionPasteLayerStyle() { return mActionPasteStyle; }
QAction *actionOpenTable() { return mActionOpenTable; }
QAction *actionOpenFieldCalculator() { return mActionOpenFieldCalc; }
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; }
//! @note added in 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 *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 *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 *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 *editMenu() { return mEditMenu; }
QMenu *viewMenu() { return mViewMenu; }
QMenu *layerMenu() { return mLayerMenu; }
QMenu *newLayerMenu() { return mNewLayerMenu; }
//! @note added in 2.5
QMenu *addLayerMenu() { return mAddLayerMenu; }
QMenu *settingsMenu() { return mSettingsMenu; }
QMenu *pluginMenu() { return mPluginMenu; }
QMenu *databaseMenu() { return mDatabaseMenu; }
QMenu *rasterMenu() { return mRasterMenu; }
QMenu *vectorMenu() { return mVectorMenu; }
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 *printComposersMenu() {return mPrintComposersMenu;}
QMenu *helpMenu() { return mHelpMenu; }
//! Toolbars
/** Get 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 *mapNavToolToolBar() { return mMapNavToolBar; }
QToolBar *digitizeToolBar() { return mDigitizeToolBar; }
QToolBar *advancedDigitizeToolBar() { return mAdvancedDigitizeToolBar; }
QToolBar *attributesToolBar() { return mAttributesToolBar; }
QToolBar *pluginToolBar() { return mPluginToolBar; }
QToolBar *helpToolBar() { return mHelpToolBar; }
QToolBar *rasterToolBar() { return mRasterToolBar; }
QToolBar *vectorToolBar() { return mVectorToolBar; }
QToolBar *databaseToolBar() { return mDatabaseToolBar; }
QToolBar *webToolBar() { return mWebToolBar; }
//! return CAD dock widget
QgsAdvancedDigitizingDockWidget *cadDockWidget() { return mAdvancedDigitizingDockWidget; }
//! Returns map overview canvas
QgsMapOverviewCanvas *mapOverviewCanvas() { return mOverviewCanvas; }
//! show layer properties
void showLayerProperties( QgsMapLayer *ml );
//! returns pointer to map legend
QgsLayerTreeView *layerTreeView();
QgsLayerTreeMapCanvasBridge *layerTreeCanvasBridge() { return mLayerTreeCanvasBridge; }
//! returns pointer to plugin manager
QgsPluginManager *pluginManager();
/** Return 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 ) const;
//! Get timeout for timed messages: default of 5 seconds
int messageTimeout();
//! emit initializationCompleted signal
void completeInitialization();
void emitCustomCrsValidation( QgsCoordinateReferenceSystem &crs );
QList<QgsDecorationItem *> decorationItems() { return mDecorationItems; }
void addDecorationItem( QgsDecorationItem *item ) { mDecorationItems.append( item ); }
//! @note added in 2.1
static QString normalizedMenuName( const QString &name ) { return name.normalized( QString::NormalizationForm_KD ).remove( QRegExp( "[^a-zA-Z]" ) ); }
#ifdef Q_OS_WIN
static LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo );
#endif
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 custom drop handler.
void registerCustomDropHandler( QgsCustomDropHandler *handler );
//! Unregister a previously registered custom drop handler.
void unregisterCustomDropHandler( QgsCustomDropHandler *handler );
//! Process the list of URIs that have been dropped in QGIS
void handleDropUriList( const QgsMimeDataUtils::UriList &lst );
public slots:
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 );
void activeLayerChanged( QgsMapLayer *layer );
//! 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();
void fieldCalculator();
//! mark project dirty
void markDirty();
void layersWereAdded( const QList<QgsMapLayer *> & );
/* 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
* @param triggerRepaint send layer signal to repaint canvas when done
*/
void cancelEdits( QgsMapLayer *layer, bool leaveEditable = true, bool triggerRepaint = true );
//! Save current edits for selected layer(s) and start new transaction(s)
void saveEdits();
//! Save edits for all layers and start new transactions
void saveAllEdits( bool verifyAction = true );
//! Rollback current edits for selected layer(s) and start new transaction(s)
void rollbackEdits();
//! Rollback edits for all layers and start new transactions
void rollbackAllEdits( bool verifyAction = true );
//! Cancel edits for selected layer(s) and toggle off editing
void cancelEdits();
//! Cancel all edits for all layers and toggle off editing
void cancelAllEdits( bool verifyAction = true );
void updateUndoActions();
//! cuts selected features on the active layer to the clipboard
/**
\param layerContainingSelection The layer that the selection will be taken from
(defaults to the active layer on the legend)
*/
void editCut( QgsMapLayer *layerContainingSelection = nullptr );
//! copies selected features on the active layer to the clipboard
/**
\param layerContainingSelection The layer that the selection will be taken from
(defaults to the active layer on the legend)
*/
void editCopy( QgsMapLayer *layerContainingSelection = nullptr );
//! copies features on the clipboard to the active layer
/**
\param destinationLayer The layer that the clipboard will be pasted to
(defaults to the active layer on the legend)
*/
void editPaste( QgsMapLayer *destinationLayer = nullptr );
//! copies features on the clipboard to a new vector layer
void pasteAsNewVector();
//! copies features on the clipboard to a new memory vector layer
QgsVectorLayer *pasteAsNewMemoryVector( const QString &layerName = QString() );
//! copies style of the active layer to the clipboard
/**
\param sourceLayer The layer where the style will be taken from
(defaults to the active layer on the legend)
*/
void copyStyle( QgsMapLayer *sourceLayer = nullptr );
//! pastes style on the clipboard to the active layer
/**
\param destinationLayer The layer that the clipboard will be pasted to
(defaults to the active layer on the legend)
*/
void pasteStyle( QgsMapLayer *destinationLayer = nullptr );
//! copies features to internal clipboard
void copyFeatures( QgsFeatureStore &featureStore );
void loadGDALSublayers( const QString &uri, const QStringList &list );
//! Deletes the selected attributes for the currently selected vector layer
void deleteSelected( QgsMapLayer *layer = nullptr, QWidget *parent = nullptr, bool promptConfirmation = false );
//! project was written
void writeProject( QDomDocument & );
//! project was read
void readProject( const QDomDocument & );
//! Set app stylesheet from settings
void setAppStyleSheet( const QString &stylesheet );
//! request credentials for network manager
void namAuthenticationRequired( QNetworkReply *reply, QAuthenticator *auth );
void namProxyAuthenticationRequired( const QNetworkProxy &proxy, QAuthenticator *auth );
#ifndef QT_NO_SSL
void namSslErrors( QNetworkReply *reply, const QList<QSslError> &errors );
#endif
void namRequestTimedOut( QNetworkReply *reply );
//! Schedule and erase of the authentication database upon confirmation
void eraseAuthenticationDatabase();
//! Push authentication manager output to messagebar
void authMessageOut( const QString &message, const QString &authtag, QgsAuthManager::MessageLevel level );
//! update default action of toolbutton
void toolButtonActionTriggered( QAction * );
//! layer selection changed
void legendLayerSelectionChanged();
//! Watch for QFileOpenEvent.
virtual bool event( QEvent *event ) override;
//! Open a raster layer using the Raster Data Provider.
QgsRasterLayer *addRasterLayer( QString const &uri, QString const &baseName, QString const &providerKey );
//! Open a plugin layer using its provider
QgsPluginLayer *addPluginLayer( const QString &uri, const QString &baseName, const QString &providerKey );
void addWfsLayer( const QString &uri, const QString &typeName );
void addAfsLayer( const QString &uri, const QString &typeName );
void addAmsLayer( const QString &uri, const QString &typeName );
void versionReplyFinished();
QgsMessageLogViewer *logViewer() { return mLogViewer; }
//! Update project menu with the project templates
void updateProjectFromTemplates();
//! Opens the options dialog
void showOptionsDialog( QWidget *parent = nullptr, const QString ¤tPage = QString() );
/** Refreshes the state of the layer actions toolbar action
* @note added in 2.1 */
void refreshActionFeatureAction();
QMenu *panelMenu() { return mPanelMenu; }
protected:
//! Handle state changes (WindowTitleChange)
virtual void changeEvent( QEvent *event ) override;
//! Have some control over closing of the application
virtual void closeEvent( QCloseEvent *event ) override;
virtual void dragEnterEvent( QDragEnterEvent *event ) override;
virtual void dropEvent( QDropEvent *event ) override;
//! reimplements widget keyPress event so we can check if cancel was pressed
virtual void keyPressEvent( QKeyEvent *event ) override;
#ifdef ANDROID
//! reimplements widget keyReleaseEvent event so we can check if back was pressed
virtual void keyReleaseEvent( QKeyEvent *event );
#endif
private slots:
void onTaskCompleteShowNotify( long taskId, int status );
void onTransactionGroupsChanged();
void onSnappingConfigChanged();
//! validate a SRS
void validateCrs( QgsCoordinateReferenceSystem &crs );
//! QGis Sponsors
void sponsors();
//! About QGis
void about();
//! Add a raster layer to the map (will prompt user for file name using dlg )
void addRasterLayer();
//#ifdef HAVE_POSTGRESQL
//! Add a databaselayer to the map
void addDatabaseLayer();
//#endif
//! Add a list of database layers to the map
void addDatabaseLayers( QStringList const &layerPathList, QString const &providerKey );
//! Add a SpatiaLite layer to the map
void addSpatiaLiteLayer();
//! Add a Delimited Text layer to the map
void addDelimitedTextLayer();
//! Add a vector layer defined by uri, layer name, data source uri
void addSelectedVectorLayer( const QString &uri, const QString &layerName, const QString &provider );
//! Replace the selected layer by a vector layer defined by uri, layer name, data source uri
void replaceSelectedVectorLayer( const QString &oldId, const QString &uri, const QString &layerName, const QString &provider );
//! Add a MSSQL layer to the map
void addMssqlLayer();
//! Add a DB2 layer to the map
void addDb2Layer();
//#ifdef HAVE_ORACLE
//! Add a Oracle layer to the map
void addOracleLayer();
//#endif
//! Add a virtual layer
void addVirtualLayer();
//! toggles whether the current selected layer is in overview or not
void isInOverview();
//! Store the position for map tool tip
void saveLastMousePosition( const QgsPoint & );
//! Slot to show current map scale;
void showScale( double scale );
//! Slot to handle user rotation input;
//! @note added in 2.8
void userRotation();
//! Remove a layer from the map and legend
void removeLayer();
//! Duplicate map layer(s) in legend
void duplicateLayers( const QList<QgsMapLayer *> &lyrList = QList<QgsMapLayer *>() );
//! Set scale visibility of selected layers
void setLayerScaleVisibility();
//! Zoom to nearest scale such that current layer is visible
void zoomToLayerScale();
//! Set CRS of a layer
void setLayerCrs();
//! Assign layer CRS to project
void setProjectCrsFromLayer();
/** Zooms so that the pixels of the raster layer occupies exactly one screen pixel.
Only works on raster layers*/
void legendLayerZoomNative();
/** Stretches the raster layer, if stretching is active, based on the min and max of the current extent.
Only workds on raster layers*/
void legendLayerStretchUsingCurrentExtent();
//! Apply the same style to selected layers or to current legend group
void applyStyleToGroup();
//! Set the CRS of the current legend group
void legendGroupSetCrs();
//! Set the WMS data of the current legend group
void legendGroupSetWmsData();
//! zoom to extent of layer
void zoomToLayerExtent();
//! zoom to actual size of raster layer
void zoomActualSize();
/** Perform a local histogram stretch on the active raster layer
* (stretch based on pixel values in view extent).
* Valid for non wms raster layers only. */
void localHistogramStretch();
/** Perform a full histogram stretch on the active raster layer
* (stretch based on pixels values in full dataset)
* Valid for non wms raster layers only. */
void fullHistogramStretch();
//! Perform a local cumulative cut stretch
void localCumulativeCutStretch();
//! Perform a full extent cumulative cut stretch
void fullCumulativeCutStretch();
/** Increase raster brightness
* Valid for non wms raster layers only. */
void increaseBrightness();
/** Decrease raster brightness
* Valid for non wms raster layers only. */
void decreaseBrightness();
/** Increase raster contrast
* Valid for non wms raster layers only. */
void increaseContrast();
/** Decrease raster contrast
* Valid for non wms raster layers only. */
void decreaseContrast();
//! plugin manager
void showPluginManager();
//! load python support if possible
void loadPythonSupport();
/** Install plugin from ZIP file
* @note added in QGIS 3.0
*/
void installPluginFromZip();
//! Find the QMenu with the given name within plugin menu (ie the user visible text on the menu item)
QMenu *getPluginMenu( const QString &menuName );
//! Add the action to the submenu with the given name under the plugin menu
void addPluginToMenu( const QString &name, QAction *action );
//! Remove the action to the submenu with the given name under the plugin menu
void removePluginMenu( const QString &name, QAction *action );
//! Find the QMenu with the given name within the Database menu (ie the user visible text on the menu item)
QMenu *getDatabaseMenu( const QString &menuName );
//! Add the action to the submenu with the given name under the Database menu
void addPluginToDatabaseMenu( const QString &name, QAction *action );
//! Remove the action to the submenu with the given name under the Database menu
void removePluginDatabaseMenu( const QString &name, QAction *action );
//! Find the QMenu with the given name within the Raster menu (ie the user visible text on the menu item)
QMenu *getRasterMenu( const QString &menuName );
//! Add the action to the submenu with the given name under the Raster menu
void addPluginToRasterMenu( const QString &name, QAction *action );
//! Remove the action to the submenu with the given name under the Raster menu
void removePluginRasterMenu( const QString &name, QAction *action );
//! Find the QMenu with the given name within the Vector menu (ie the user visible text on the menu item)
QMenu *getVectorMenu( const QString &menuName );
//! Add the action to the submenu with the given name under the Vector menu
void addPluginToVectorMenu( const QString &name, QAction *action );
//! Remove the action to the submenu with the given name under the Vector menu
void removePluginVectorMenu( const QString &name, QAction *action );
//! Find the QMenu with the given name within the Web menu (ie the user visible text on the menu item)
QMenu *getWebMenu( const QString &menuName );
//! Add the action to the submenu with the given name under the Web menu
void addPluginToWebMenu( const QString &name, QAction *action );
//! Remove the action to the submenu with the given name under the Web menu
void removePluginWebMenu( const QString &name, QAction *action );
//! Add "add layer" action to layer menu
void insertAddLayerAction( QAction *action );
//! Remove "add layer" action to layer menu
void removeAddLayerAction( QAction *action );
//! Add an icon to the plugin toolbar
int addPluginToolBarIcon( QAction *qAction );
/**
* Add a widget to the plugins toolbar.
* To remove this widget again, call {@link removeToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction *addPluginToolBarWidget( QWidget *widget );
//! Remove an icon from the plugin toolbar
void removePluginToolBarIcon( QAction *qAction );
//! Add an icon to the Raster toolbar
int addRasterToolBarIcon( QAction *qAction );
/**
* Add a widget to the raster toolbar.
* To remove this widget again, call {@link removeRasterToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction *addRasterToolBarWidget( QWidget *widget );
//! Remove an icon from the Raster toolbar
void removeRasterToolBarIcon( QAction *qAction );
//! Add an icon to the Vector toolbar
int addVectorToolBarIcon( QAction *qAction );
/**
* Add a widget to the vector toolbar.
* To remove this widget again, call {@link removeVectorToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction *addVectorToolBarWidget( QWidget *widget );
//! Remove an icon from the Vector toolbar
void removeVectorToolBarIcon( QAction *qAction );
//! Add an icon to the Database toolbar
int addDatabaseToolBarIcon( QAction *qAction );
/**
* Add a widget to the database toolbar.
* To remove this widget again, call {@link removeDatabaseToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction *addDatabaseToolBarWidget( QWidget *widget );
//! Remove an icon from the Database toolbar
void removeDatabaseToolBarIcon( QAction *qAction );
//! Add an icon to the Web toolbar
int addWebToolBarIcon( QAction *qAction );
/**
* Add a widget to the web toolbar.
* To remove this widget again, call {@link removeWebToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction *addWebToolBarWidget( QWidget *widget );
//! Remove an icon from the Web toolbar
void removeWebToolBarIcon( QAction *qAction );
//! Save window state
void saveWindowState();
//! Restore the window and toolbar state
void restoreWindowState();
//! Save project. Returns true if the user selected a file to save to, false if not.
bool fileSave();
//! Save project as
void fileSaveAs();
//! Export project in dxf format
void dxfExport();
//! Import layers in dwg format
void dwgImport();
//! Open the project file corresponding to the
//! text)= of the given action.
void openProject( QAction *action );
/** Attempts to run a python script
* @param filePath full path to python script
* @note added in QGIS 2.7