QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
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 "qgis_gui.h"
22 #include "qgis_sip.h"
23 #include <QWidget>
24 #include <memory>
25 
32 class QgsNative;
37 class QgsProcessingRecentAlgorithmLog;
38 class QgsWindowManagerInterface;
44 class QgsMessageBar;
53 
59 class GUI_EXPORT QgsGui : public QObject
60 {
61  Q_OBJECT
62 
63  public:
64 
69  {
70  UseCrsOfFirstLayerAdded = 1,
71  UsePresetCrs = 2,
72  };
73  Q_ENUM( ProjectCrsBehavior )
74 
75 
76  QgsGui( const QgsGui &other ) = delete;
77 
79  QgsGui &operator=( const QgsGui &other ) = delete;
80 
84  static QgsGui *instance();
85 
91  SIP_SKIP static QgsNative *nativePlatformInterface();
92 
97  static QgsSettingsRegistryGui *settingsRegistryGui() SIP_KEEPREFERENCE;
98 
102  static QgsEditorWidgetRegistry *editorWidgetRegistry() SIP_KEEPREFERENCE;
103 
107  static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry() SIP_KEEPREFERENCE;
108 
112  static QgsShortcutsManager *shortcutsManager();
113 
117  static QgsLayerTreeEmbeddedWidgetRegistry *layerTreeEmbeddedWidgetRegistry() SIP_KEEPREFERENCE;
118 
122  static QgsMapLayerActionRegistry *mapLayerActionRegistry() SIP_KEEPREFERENCE;
123 
127  static QgsLayoutItemGuiRegistry *layoutItemGuiRegistry() SIP_KEEPREFERENCE;
128 
134  static QgsAnnotationItemGuiRegistry *annotationItemGuiRegistry() SIP_KEEPREFERENCE;
135 
140  static QgsProcessingGuiRegistry *processingGuiRegistry() SIP_KEEPREFERENCE;
141 
146  static QgsNumericFormatGuiRegistry *numericFormatGuiRegistry() SIP_KEEPREFERENCE;
147 
152  static QgsCodeEditorColorSchemeRegistry *codeEditorColorSchemeRegistry() SIP_KEEPREFERENCE;
153 
158  static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
159 
165  static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() SIP_KEEPREFERENCE;
166 
171  static QgsProjectStorageGuiRegistry *projectStorageGuiRegistry() SIP_KEEPREFERENCE;
172 
177  static QgsProviderGuiRegistry *providerGuiRegistry() SIP_KEEPREFERENCE;
178 
183  static QgsSensorGuiRegistry *sensorGuiRegistry() SIP_KEEPREFERENCE;
184 
189  static QgsSubsetStringEditorProviderRegistry *subsetStringEditorProviderRegistry() SIP_KEEPREFERENCE;
190 
195  static QgsProviderSourceWidgetProviderRegistry *sourceWidgetProviderRegistry() SIP_KEEPREFERENCE;
196 
201  static QgsRelationWidgetRegistry *relationWidgetRegistry() SIP_KEEPREFERENCE;
202 
208  static QgsMapToolShapeRegistry *mapToolShapeRegistry() SIP_SKIP;
209 
214  static QgsHistoryProviderRegistry *historyProviderRegistry() SIP_KEEPREFERENCE;
215 
220  static QgsSettingsEditorWidgetRegistry *settingsEditorWidgetRegistry() SIP_KEEPREFERENCE;
221 
226  static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
227 
233  static QgsWindowManagerInterface *windowManager();
234 
240  static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
241 
246  static QgsInputControllerManager *inputControllerManager() SIP_KEEPREFERENCE;
247 
252  enum HigFlag SIP_ENUM_BASETYPE( IntFlag )
253  {
254  HigMenuTextIsTitleCase = 1 << 0,
255  HigDialogTitleIsTitleCase = 1 << 1
256  };
257  Q_DECLARE_FLAGS( HigFlags, HigFlag )
258 
259 
263  static QgsGui::HigFlags higFlags();
264 
265  ~QgsGui();
266 
272  static QColor sampleColor( QPoint point );
273 
279  static QScreen *findScreenAt( QPoint point );
280 
290  static bool pythonMacroAllowed( void ( *lambda )() = nullptr, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
291 
293  void emitOptionsChanged() SIP_SKIP;
295 
296  signals:
297 
308  void optionsChanged();
309 
310  private:
311 
312  QgsGui();
313 
314  QgsSettingsRegistryGui *mSettingsRegistryGui = nullptr;
315  QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
316  QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
317  QgsNative *mNative = nullptr;
318  QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
319  QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
320  QgsShortcutsManager *mShortcutsManager = nullptr;
321  QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
322  QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
323  QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
324  QgsAnnotationItemGuiRegistry *mAnnotationItemGuiRegistry = nullptr;
325  QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
326  QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
327  QgsNumericFormatGuiRegistry *mNumericFormatGuiRegistry = nullptr;
328  QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
329  QgsCodeEditorColorSchemeRegistry *mCodeEditorColorSchemeRegistry = nullptr;
330  QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
331  QgsSubsetStringEditorProviderRegistry *mSubsetStringEditorProviderRegistry = nullptr;
332  QgsProviderSourceWidgetProviderRegistry *mProviderSourceWidgetProviderRegistry = nullptr;
333  QgsRelationWidgetRegistry *mRelationEditorRegistry = nullptr;
334  QgsMapToolShapeRegistry *mShapeMapToolRegistry = nullptr;
335  QgsHistoryProviderRegistry *mHistoryProviderRegistry = nullptr;
336  QgsSensorGuiRegistry *mSensorGuiRegistry = nullptr;
337  QgsSettingsEditorWidgetRegistry *mSettingsEditorRegistry = nullptr;
338  QgsInputControllerManager *mInputControllerManager = nullptr;
339  std::unique_ptr< QgsWindowManagerInterface > mWindowManager;
340 
341 #ifdef SIP_RUN
342  QgsGui( const QgsGui &other );
343 #endif
344 
345 };
346 
348 
349 #endif // QGSGUI_H
Registry of available annotation item GUI behavior.
A registry of color schemes for use in QgsCodeEditor widgets.
This class keeps a list of data item GUI providers that may affect how QgsDataItems behave within the...
This class manages all known edit widget factories.
QgsGui is a singleton class containing various registry and other global members related to GUI class...
Definition: qgsgui.h:60
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition: qgsgui.h:253
QFlags< HigFlag > HigFlags
Definition: qgsgui.h:257
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition: qgsgui.h:69
The QgsHistoryProviderRegistry is a registry for objects which track user history (i....
Manages input control devices.
Registry of widgets that may be embedded into layer tree view.
Registry of available layout item GUI behavior.
This class tracks map layer actions.
Keeps track of the registered shape map tools.
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
The QgsNumericFormatGuiRegistry is a home for widgets for configuring QgsNumericFormat objects.
The QgsProcessingGuiRegistry is a home for widgets for processing configuration widgets.
A registry / canonical manager of GUI parts of project storage backends.
A registry / canonical manager of GUI parts of data providers.
This class keeps a list of provider source widget providers.
Keeps track of the registered relations widgets.
Registry of available sensor GUI behavior.
This class manages editor widgets for settings.
QgsSettingsRegistryGui is used for settings introspection and collects all QgsSettingsEntry instances...
Shortcuts manager is a class that contains a list of QActions and QShortcuts that have been registere...
This class keeps a list of source select providers that may add items to the QgsDataSourceManagerDial...
This class keeps a list of subset string editor providers.
QgsWidgetStateHelper is a helper class to save and restore the geometry of QWidgets in the applicatio...
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:73
#define SIP_KEEPREFERENCE
Definition: qgis_sip.h:86
#define SIP_ENUM_BASETYPE(type)
Definition: qgis_sip.h:278
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)