QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 <QWidget>
29
36class QgsNative;
42class QgsProcessingFavoriteAlgorithmManager;
43class QgsProcessingRecentAlgorithmLog;
44class QgsWindowManagerInterface;
47class QgsProject;
51class QgsMessageBar;
61
67class GUI_EXPORT QgsGui : public QObject
68{
69 Q_OBJECT
70
71 public:
72 static inline QgsSettingsTreeNode *sTtreeWidgetGeometry = QgsSettingsTree::sTreeApp->createChildNode( QStringLiteral( "widget-geometry" ) ) SIP_SKIP;
73 static inline QgsSettingsTreeNode *sTtreeWidgetLastUsedValues = QgsSettingsTree::sTreeApp->createChildNode( QStringLiteral( "widget-last-used-values" ) ) SIP_SKIP;
74
83 Q_ENUM( ProjectCrsBehavior )
84
85 QgsGui( const QgsGui &other ) = delete;
86 QgsGui &operator=( const QgsGui &other ) = delete;
87
91 static QgsGui *instance();
92
98 SIP_SKIP static QgsNative *nativePlatformInterface();
99
105
110
115
120
125
130
135
142
149
155
161
167
172 static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
173
178 static QgsProcessingFavoriteAlgorithmManager *processingFavoriteAlgorithmManager();
179
186
192
198
204
210
216
222
229
235
241
246 static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
247
253 static QgsWindowManagerInterface *windowManager();
254
260 static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
261
267
273
283 Q_DECLARE_FLAGS( HigFlags, HigFlag )
284
285
289 static QgsGui::HigFlags higFlags();
290
291 ~QgsGui() override;
292
298 static QColor sampleColor( QPoint point );
299
305 static QScreen *findScreenAt( QPoint point );
306
316 static bool allowExecutionOfEmbeddedScripts( QgsProject *project, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
317
324 static void initCalloutWidgets() SIP_SKIP;
325
332 static void initPlotWidgets() SIP_SKIP;
333
339 static bool hasWebEngine();
340
342 void emitOptionsChanged() SIP_SKIP;
344
345 signals:
346
358
359 private:
360 QgsGui();
361
362 QgsSettingsRegistryGui *mSettingsRegistryGui = nullptr;
363 QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
364 QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
365 QgsNative *mNative = nullptr;
366 QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
367 QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
368 QgsShortcutsManager *mShortcutsManager = nullptr;
369 QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
370 QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
371 QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
372 QgsAnnotationItemGuiRegistry *mAnnotationItemGuiRegistry = nullptr;
373 QgsAdvancedDigitizingToolsRegistry *mAdvancedDigitizingToolsRegistry = nullptr;
374 QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
375 QgsProcessingFavoriteAlgorithmManager *mProcessingFavoriteAlgorithmManager = nullptr;
376 QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
377 QgsNumericFormatGuiRegistry *mNumericFormatGuiRegistry = nullptr;
378 QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
379 QgsCodeEditorColorSchemeRegistry *mCodeEditorColorSchemeRegistry = nullptr;
380 QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
381 QgsSubsetStringEditorProviderRegistry *mSubsetStringEditorProviderRegistry = nullptr;
382 QgsProviderSourceWidgetProviderRegistry *mProviderSourceWidgetProviderRegistry = nullptr;
383 QgsRelationWidgetRegistry *mRelationEditorRegistry = nullptr;
384 QgsMapToolShapeRegistry *mShapeMapToolRegistry = nullptr;
385 QgsHistoryProviderRegistry *mHistoryProviderRegistry = nullptr;
386 QgsSensorGuiRegistry *mSensorGuiRegistry = nullptr;
387 QgsSettingsEditorWidgetRegistry *mSettingsEditorRegistry = nullptr;
388 QgsInputControllerManager *mInputControllerManager = nullptr;
389 QgsStoredQueryManager *mStoredQueryManager = nullptr;
390 std::unique_ptr<QgsWindowManagerInterface> mWindowManager;
391
392#ifdef SIP_RUN
393 QgsGui( const QgsGui &other );
394#endif
395};
396
398
399#endif // QGSGUI_H
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 QgsMapToolShapeRegistry * mapToolShapeRegistry()
Returns the registry of shape map tools.
Definition qgsgui.cpp:116
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories.
Definition qgsgui.cpp:106
static QgsProviderSourceWidgetProviderRegistry * sourceWidgetProviderRegistry()
Returns the registry of provider source widget providers.
Definition qgsgui.cpp:131
static QgsProcessingGuiRegistry * processingGuiRegistry()
Returns the global processing gui registry, used for registering the GUI behavior of processing algor...
Definition qgsgui.cpp:166
static QgsShortcutsManager * shortcutsManager()
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.
Definition qgsgui.cpp:136
static void setWindowManager(QgsWindowManagerInterface *manager)
Sets the global window manager.
Definition qgsgui.cpp:245
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:235
static QgsProcessingFavoriteAlgorithmManager * processingFavoriteAlgorithmManager()
Returns the global Processing favorite algorithm manager, used for tracking favorite Processing algor...
Definition qgsgui.cpp:181
static QgsLayerTreeEmbeddedWidgetRegistry * layerTreeEmbeddedWidgetRegistry()
Returns the global layer tree embedded widget registry, used for registering widgets that may be embe...
Definition qgsgui.cpp:141
static QScreen * findScreenAt(QPoint point)
Returns the screen at the given global point (pixel).
Definition qgsgui.cpp:309
static QgsAnnotationItemGuiRegistry * annotationItemGuiRegistry()
Returns the global annotation item GUI registry, used for registering the GUI behavior of annotation ...
Definition qgsgui.cpp:156
static QgsMapLayerActionRegistry * mapLayerActionRegistry()
Returns the global map layer action registry, used for registering map layer actions.
Definition qgsgui.cpp:146
static QgsGui * instance()
Returns a pointer to the singleton instance.
Definition qgsgui.cpp:90
static QgsProviderGuiRegistry * providerGuiRegistry()
Returns the registry of GUI-related components of data providers.
Definition qgsgui.cpp:201
static QgsRelationWidgetRegistry * relationWidgetRegistry()
Returns the global relation widget registry, used for managing all known relation widget factories.
Definition qgsgui.cpp:111
static QgsSensorGuiRegistry * sensorGuiRegistry()
Returns the registry of GUI-related components for sensors.
Definition qgsgui.cpp:206
static QgsAdvancedDigitizingToolsRegistry * advancedDigitizingToolsRegistry()
Returns the global advanced digitizing tools registry, used for registering advanced digitizing tools...
Definition qgsgui.cpp:161
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:221
static QgsHistoryProviderRegistry * historyProviderRegistry()
Returns the global history provider registry, used for tracking history providers.
Definition qgsgui.cpp:211
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:394
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition qgsgui.h:279
@ HigMenuTextIsTitleCase
Menu action texts should be title case.
Definition qgsgui.h:280
@ HigDialogTitleIsTitleCase
Dialog titles should be title case.
Definition qgsgui.h:281
static QgsStoredQueryManager * storedQueryManager()
Returns the global stored SQL query manager.
Definition qgsgui.cpp:240
static QgsNative * nativePlatformInterface()
Returns the global native interface, which offers abstraction to the host OS's underlying public inte...
Definition qgsgui.cpp:96
static bool hasWebEngine()
Checks whether QWebEngineView is available to display HTML content.
Definition qgsgui.cpp:487
QgsGui(const QgsGui &other)=delete
static QgsWindowManagerInterface * windowManager()
Returns the global window manager, if set.
Definition qgsgui.cpp:230
static QgsDataItemGuiProviderRegistry * dataItemGuiProviderRegistry()
Returns the global data item GUI provider registry, used for tracking providers which affect the brow...
Definition qgsgui.cpp:191
static QgsProcessingRecentAlgorithmLog * processingRecentAlgorithmLog()
Returns the global processing recent algorithm log, used for tracking recently used processing algori...
Definition qgsgui.cpp:186
QFlags< HigFlag > HigFlags
Definition qgsgui.h:283
static QgsSubsetStringEditorProviderRegistry * subsetStringEditorProviderRegistry()
Returns the registry of subset string editors of data providers.
Definition qgsgui.cpp:126
static QgsSettingsTreeNode * sTtreeWidgetLastUsedValues
Definition qgsgui.h:73
static QgsProjectStorageGuiRegistry * projectStorageGuiRegistry()
Returns the global GUI-related project storage registry.
Definition qgsgui.cpp:196
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition qgsgui.h:79
@ UseCrsOfFirstLayerAdded
Set the project CRS to the CRS of the first layer added to a new project.
Definition qgsgui.h:80
@ UsePresetCrs
Always set new projects to use a preset default CRS.
Definition qgsgui.h:81
static QgsGui::HigFlags higFlags()
Returns the platform's HIG flags.
Definition qgsgui.cpp:250
static QgsLayoutItemGuiRegistry * layoutItemGuiRegistry()
Returns the global layout item GUI registry, used for registering the GUI behavior of layout items.
Definition qgsgui.cpp:151
static void initPlotWidgets()
Initializes plot widgets.
Definition qgsgui.cpp:458
static void initCalloutWidgets()
Initializes callout widgets.
Definition qgsgui.cpp:428
static QgsSettingsRegistryGui * settingsRegistryGui()
Returns the gui's settings registry, used for managing gui settings.
Definition qgsgui.cpp:101
static QgsSourceSelectProviderRegistry * sourceSelectProviderRegistry()
Returns the global source select provider registry, used for managing all known source select widget ...
Definition qgsgui.cpp:121
static QgsCodeEditorColorSchemeRegistry * codeEditorColorSchemeRegistry()
Returns the global code editor color scheme registry, used for registering the color schemes for QgsC...
Definition qgsgui.cpp:176
static QgsNumericFormatGuiRegistry * numericFormatGuiRegistry()
Returns the global numeric format gui registry, used for registering the GUI widgets associated with ...
Definition qgsgui.cpp:171
static QgsSettingsEditorWidgetRegistry * settingsEditorWidgetRegistry()
Returns the registry of settings editors.
Definition qgsgui.cpp:216
static QgsSettingsTreeNode * sTtreeWidgetGeometry
Definition qgsgui.h:72
static QColor sampleColor(QPoint point)
Samples the color on screen at the specified global point (pixel).
Definition qgsgui.cpp:294
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:109
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:94
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:275
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_TRANSFER
Definition qgis_sip.h:36
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)