QGIS API Documentation 4.3.0-Master (4a47d6a9bb1)
Loading...
Searching...
No Matches
qgsgui.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgui.h
3 --------
4 begin : May 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSGUI_H
19#define QGSGUI_H
20
21#include <memory>
22
23#include "qgis.h"
24#include "qgis_gui.h"
25#include "qgis_sip.h"
26#include "qgssettingstree.h"
27
28#include <QString>
29#include <QWidget>
30
31using namespace Qt::StringLiterals;
32
39class QgsNative;
45class QgsProcessingFavoriteAlgorithmManager;
46class QgsProcessingRecentAlgorithmLog;
47class QgsWindowManagerInterface;
50class QgsProject;
54class QgsMessageBar;
64
70class GUI_EXPORT QgsGui : public QObject
71{
72 Q_OBJECT
73
74 public:
75 static inline QgsSettingsTreeNode *sTtreeWidgetGeometry = QgsSettingsTree::sTreeApp->createChildNode( u"widget-geometry"_s ) SIP_SKIP;
76 static inline QgsSettingsTreeNode *sTtreeWidgetLastUsedValues = QgsSettingsTree::sTreeApp->createChildNode( u"widget-last-used-values"_s ) SIP_SKIP;
77
86 Q_ENUM( ProjectCrsBehavior )
87
88 QgsGui( const QgsGui &other ) = delete;
89 QgsGui &operator=( const QgsGui &other ) = delete;
90
94 static QgsGui *instance();
95
101 SIP_SKIP static QgsNative *nativePlatformInterface();
102
108
113
118
123
128
133
138
145
152
158
164
170
175 static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
176
181 static QgsProcessingFavoriteAlgorithmManager *processingFavoriteAlgorithmManager();
182
189
195
201
207
213
219
225
232
238
244
249 static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
250
256 static QgsWindowManagerInterface *windowManager();
257
263 static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
264
270
276
286 Q_DECLARE_FLAGS( HigFlags, HigFlag )
287
288
292 static QgsGui::HigFlags higFlags();
293
294 ~QgsGui() override;
295
301 static QColor sampleColor( QPoint point );
302
308 static QScreen *findScreenAt( QPoint point );
309
319 static bool allowExecutionOfEmbeddedScripts( QgsProject *project, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
320
327 static void initCalloutWidgets() SIP_SKIP;
328
335 static void initPlotWidgets() SIP_SKIP;
336
342 static bool hasWebEngine();
343
349 static QSize iconSize( Qgis::UserInterfaceIconType iconType = Qgis::UserInterfaceIconType::MainWindowToolbar );
350
352 void emitOptionsChanged() SIP_SKIP;
354
364 static QString applicationStyleSheet();
365
374 void setApplicationStyleSheet( const QString &styleSheet ) SIP_SKIP;
375
376 signals:
377
389
396 void applicationStyleSheetChanged( const QString &styleSheet );
397
398 private:
399 QgsGui();
400
401 std::unique_ptr<QgsSettingsRegistryGui> mSettingsRegistryGui;
402 std::unique_ptr<QgsProviderGuiRegistry> mProviderGuiRegistry;
403 std::unique_ptr<QgsWidgetStateHelper> mWidgetStateHelper;
404 std::unique_ptr<QgsNative> mNative;
405 std::unique_ptr<QgsEditorWidgetRegistry> mEditorWidgetRegistry;
406 std::unique_ptr<QgsSourceSelectProviderRegistry> mSourceSelectProviderRegistry;
407 std::unique_ptr<QgsShortcutsManager> mShortcutsManager;
408 std::unique_ptr<QgsLayerTreeEmbeddedWidgetRegistry> mLayerTreeEmbeddedWidgetRegistry;
409 std::unique_ptr<QgsMapLayerActionRegistry> mMapLayerActionRegistry;
410 std::unique_ptr<QgsLayoutItemGuiRegistry> mLayoutItemGuiRegistry;
411 std::unique_ptr<QgsAnnotationItemGuiRegistry> mAnnotationItemGuiRegistry;
412 std::unique_ptr<QgsAdvancedDigitizingToolsRegistry> mAdvancedDigitizingToolsRegistry;
413 std::unique_ptr<QgsProcessingGuiRegistry> mProcessingGuiRegistry;
414 std::unique_ptr<QgsProcessingFavoriteAlgorithmManager> mProcessingFavoriteAlgorithmManager;
415 std::unique_ptr<QgsProcessingRecentAlgorithmLog> mProcessingRecentAlgorithmLog;
416 std::unique_ptr<QgsNumericFormatGuiRegistry> mNumericFormatGuiRegistry;
417 std::unique_ptr<QgsDataItemGuiProviderRegistry> mDataItemGuiProviderRegistry;
418 std::unique_ptr<QgsCodeEditorColorSchemeRegistry> mCodeEditorColorSchemeRegistry;
419 std::unique_ptr<QgsProjectStorageGuiRegistry> mProjectStorageGuiRegistry;
420 std::unique_ptr<QgsSubsetStringEditorProviderRegistry> mSubsetStringEditorProviderRegistry;
421 std::unique_ptr<QgsProviderSourceWidgetProviderRegistry> mProviderSourceWidgetProviderRegistry;
422 std::unique_ptr<QgsRelationWidgetRegistry> mRelationEditorRegistry;
423 std::unique_ptr<QgsMapToolShapeRegistry> mShapeMapToolRegistry;
424 std::unique_ptr<QgsHistoryProviderRegistry> mHistoryProviderRegistry;
425 std::unique_ptr<QgsSensorGuiRegistry> mSensorGuiRegistry;
426 std::unique_ptr<QgsSettingsEditorWidgetRegistry> mSettingsEditorRegistry;
427 std::unique_ptr<QgsInputControllerManager> mInputControllerManager;
428 std::unique_ptr<QgsStoredQueryManager> mStoredQueryManager;
429 std::unique_ptr<QgsWindowManagerInterface> mWindowManager;
430
431 QString mApplicationStyleSheet;
432
433#ifdef SIP_RUN
434 QgsGui( const QgsGui &other );
435#endif
436};
437
439
440#endif // QGSGUI_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
Registry of available advanced digitizing tools.
Registry of available annotation item GUI behavior.
A registry of color schemes for use in QgsCodeEditor widgets.
A registry for data item GUI providers that may affect how QgsDataItems behave within the application...
A registry that manages all known edit widget factories.
static QSize iconSize(Qgis::UserInterfaceIconType iconType=Qgis::UserInterfaceIconType::MainWindowToolbar)
Returns the desired size for user interface icons.
Definition qgsgui.cpp:509
static QgsMapToolShapeRegistry * mapToolShapeRegistry()
Returns the registry of shape map tools.
Definition qgsgui.cpp:120
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories.
Definition qgsgui.cpp:110
static QgsProviderSourceWidgetProviderRegistry * sourceWidgetProviderRegistry()
Returns the registry of provider source widget providers.
Definition qgsgui.cpp:135
static QgsProcessingGuiRegistry * processingGuiRegistry()
Returns the global processing gui registry, used for registering the GUI behavior of processing algor...
Definition qgsgui.cpp:170
static QgsShortcutsManager * shortcutsManager()
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.
Definition qgsgui.cpp:140
static void setWindowManager(QgsWindowManagerInterface *manager)
Sets the global window manager.
Definition qgsgui.cpp:249
void optionsChanged()
This signal is emitted whenever the application options have been changed.
static QgsInputControllerManager * inputControllerManager()
Returns the global input controller manager.
Definition qgsgui.cpp:239
static QgsProcessingFavoriteAlgorithmManager * processingFavoriteAlgorithmManager()
Returns the global Processing favorite algorithm manager, used for tracking favorite Processing algor...
Definition qgsgui.cpp:185
static QgsLayerTreeEmbeddedWidgetRegistry * layerTreeEmbeddedWidgetRegistry()
Returns the global layer tree embedded widget registry, used for registering widgets that may be embe...
Definition qgsgui.cpp:145
void applicationStyleSheetChanged(const QString &styleSheet)
Emitted whenever the application style sheet is changed.
static QScreen * findScreenAt(QPoint point)
Returns the screen at the given global point (pixel).
Definition qgsgui.cpp:314
static QgsAnnotationItemGuiRegistry * annotationItemGuiRegistry()
Returns the global annotation item GUI registry, used for registering the GUI behavior of annotation ...
Definition qgsgui.cpp:160
static QString applicationStyleSheet()
Returns the application style sheet.
Definition qgsgui.cpp:399
static QgsMapLayerActionRegistry * mapLayerActionRegistry()
Returns the global map layer action registry, used for registering map layer actions.
Definition qgsgui.cpp:150
static QgsGui * instance()
Returns a pointer to the singleton instance.
Definition qgsgui.cpp:94
static QgsProviderGuiRegistry * providerGuiRegistry()
Returns the registry of GUI-related components of data providers.
Definition qgsgui.cpp:205
static QgsRelationWidgetRegistry * relationWidgetRegistry()
Returns the global relation widget registry, used for managing all known relation widget factories.
Definition qgsgui.cpp:115
static QgsSensorGuiRegistry * sensorGuiRegistry()
Returns the registry of GUI-related components for sensors.
Definition qgsgui.cpp:210
static QgsAdvancedDigitizingToolsRegistry * advancedDigitizingToolsRegistry()
Returns the global advanced digitizing tools registry, used for registering advanced digitizing tools...
Definition qgsgui.cpp:165
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
Definition qgsgui.cpp:225
static QgsHistoryProviderRegistry * historyProviderRegistry()
Returns the global history provider registry, used for tracking history providers.
Definition qgsgui.cpp:215
static bool allowExecutionOfEmbeddedScripts(QgsProject *project, QgsMessageBar *messageBar=nullptr)
Returns true if python embedded in a project is currently allowed to be loaded.
Definition qgsgui.cpp:413
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition qgsgui.h:282
@ HigMenuTextIsTitleCase
Menu action texts should be title case.
Definition qgsgui.h:283
@ HigDialogTitleIsTitleCase
Dialog titles should be title case.
Definition qgsgui.h:284
static QgsStoredQueryManager * storedQueryManager()
Returns the global stored SQL query manager.
Definition qgsgui.cpp:244
static QgsNative * nativePlatformInterface()
Returns the global native interface, which offers abstraction to the host OS's underlying public inte...
Definition qgsgui.cpp:100
static bool hasWebEngine()
Checks whether QWebEngineView is available to display HTML content.
Definition qgsgui.cpp:500
QgsGui(const QgsGui &other)=delete
static QgsWindowManagerInterface * windowManager()
Returns the global window manager, if set.
Definition qgsgui.cpp:234
static QgsDataItemGuiProviderRegistry * dataItemGuiProviderRegistry()
Returns the global data item GUI provider registry, used for tracking providers which affect the brow...
Definition qgsgui.cpp:195
static QgsProcessingRecentAlgorithmLog * processingRecentAlgorithmLog()
Returns the global processing recent algorithm log, used for tracking recently used processing algori...
Definition qgsgui.cpp:190
QFlags< HigFlag > HigFlags
Definition qgsgui.h:286
static QgsSubsetStringEditorProviderRegistry * subsetStringEditorProviderRegistry()
Returns the registry of subset string editors of data providers.
Definition qgsgui.cpp:130
static QgsSettingsTreeNode * sTtreeWidgetLastUsedValues
Definition qgsgui.h:76
static QgsProjectStorageGuiRegistry * projectStorageGuiRegistry()
Returns the global GUI-related project storage registry.
Definition qgsgui.cpp:200
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition qgsgui.h:82
@ UseCrsOfFirstLayerAdded
Set the project CRS to the CRS of the first layer added to a new project.
Definition qgsgui.h:83
@ UsePresetCrs
Always set new projects to use a preset default CRS.
Definition qgsgui.h:84
static QgsGui::HigFlags higFlags()
Returns the platform's HIG flags.
Definition qgsgui.cpp:254
static QgsLayoutItemGuiRegistry * layoutItemGuiRegistry()
Returns the global layout item GUI registry, used for registering the GUI behavior of layout items.
Definition qgsgui.cpp:155
void setApplicationStyleSheet(const QString &styleSheet)
Sets the application style sheet.
Definition qgsgui.cpp:404
static void initPlotWidgets()
Initializes plot widgets.
Definition qgsgui.cpp:471
static void initCalloutWidgets()
Initializes callout widgets.
Definition qgsgui.cpp:441
static QgsSettingsRegistryGui * settingsRegistryGui()
Returns the gui's settings registry, used for managing gui settings.
Definition qgsgui.cpp:105
static QgsSourceSelectProviderRegistry * sourceSelectProviderRegistry()
Returns the global source select provider registry, used for managing all known source select widget ...
Definition qgsgui.cpp:125
static QgsCodeEditorColorSchemeRegistry * codeEditorColorSchemeRegistry()
Returns the global code editor color scheme registry, used for registering the color schemes for QgsC...
Definition qgsgui.cpp:180
static QgsNumericFormatGuiRegistry * numericFormatGuiRegistry()
Returns the global numeric format gui registry, used for registering the GUI widgets associated with ...
Definition qgsgui.cpp:175
static QgsSettingsEditorWidgetRegistry * settingsEditorWidgetRegistry()
Returns the registry of settings editors.
Definition qgsgui.cpp:220
static QgsSettingsTreeNode * sTtreeWidgetGeometry
Definition qgsgui.h:75
static QColor sampleColor(QPoint point)
Samples the color on screen at the specified global point (pixel).
Definition qgsgui.cpp:299
A registry for objects which track user history (i.e.
Manages input control devices.
Registry of widgets that may be embedded into layer tree view.
Registry of available layout item GUI behavior.
A registry which tracks map layer actions.
Keeps track of the registered shape map tools.
A bar for displaying non-blocking messages to the user.
A registry for widgets which configure QgsNumericFormat objects.
A registry for widgets for use with the Processing framework.
A registry / canonical manager of GUI parts of project storage backends.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:114
A registry / canonical manager of GUI parts of data providers.
A registry that keeps a list of provider source widget providers.
Keeps track of the registered relations widgets.
Registry of available sensor GUI behavior.
A registry that manages editor widgets for settings.
Used for settings introspection and collects all QgsSettingsEntry instances of GUI.
A tree node for the settings tree to help organizing and introspecting the tree.
static QgsSettingsTreeNode * sTreeApp
Shortcuts manager is a class that contains a list of QActions and QShortcuts that have been registere...
A registry for QgsSourceSelectProvider source select providers.
A manager for stored SQL queries.
A registry for subset string editor providers.
A helper class to save and restore the geometry of QWidgets in the application.
#define SIP_KEEPREFERENCE
Definition qgis_sip.h:93
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:272
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_TRANSFER
Definition qgis_sip.h:35
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)