QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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;
50 
57 class GUI_EXPORT QgsGui : public QObject
58 {
59  Q_OBJECT
60 
61  public:
62 
67  {
68  UseCrsOfFirstLayerAdded = 1,
69  UsePresetCrs = 2,
70  };
71  Q_ENUM( ProjectCrsBehavior )
72 
73 
74  QgsGui( const QgsGui &other ) = delete;
75 
77  QgsGui &operator=( const QgsGui &other ) = delete;
78 
82  static QgsGui *instance();
83 
89  SIP_SKIP static QgsNative *nativePlatformInterface();
90 
95  static QgsSettingsRegistryGui *settingsRegistryGui() SIP_KEEPREFERENCE;
96 
100  static QgsEditorWidgetRegistry *editorWidgetRegistry() SIP_KEEPREFERENCE;
101 
105  static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry() SIP_KEEPREFERENCE;
106 
110  static QgsShortcutsManager *shortcutsManager();
111 
115  static QgsLayerTreeEmbeddedWidgetRegistry *layerTreeEmbeddedWidgetRegistry() SIP_KEEPREFERENCE;
116 
120  static QgsMapLayerActionRegistry *mapLayerActionRegistry() SIP_KEEPREFERENCE;
121 
125  static QgsLayoutItemGuiRegistry *layoutItemGuiRegistry() SIP_KEEPREFERENCE;
126 
132  static QgsAnnotationItemGuiRegistry *annotationItemGuiRegistry() SIP_KEEPREFERENCE;
133 
138  static QgsProcessingGuiRegistry *processingGuiRegistry() SIP_KEEPREFERENCE;
139 
144  static QgsNumericFormatGuiRegistry *numericFormatGuiRegistry() SIP_KEEPREFERENCE;
145 
150  static QgsCodeEditorColorSchemeRegistry *codeEditorColorSchemeRegistry() SIP_KEEPREFERENCE;
151 
156  static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
157 
163  static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() SIP_KEEPREFERENCE;
164 
169  static QgsProjectStorageGuiRegistry *projectStorageGuiRegistry() SIP_KEEPREFERENCE;
170 
175  static QgsProviderGuiRegistry *providerGuiRegistry() SIP_KEEPREFERENCE;
176 
181  static QgsSubsetStringEditorProviderRegistry *subsetStringEditorProviderRegistry() SIP_KEEPREFERENCE;
182 
187  static QgsProviderSourceWidgetProviderRegistry *sourceWidgetProviderRegistry() SIP_KEEPREFERENCE;
188 
193  static QgsRelationWidgetRegistry *relationWidgetRegistry() SIP_KEEPREFERENCE;
194 
200  static QgsMapToolShapeRegistry *mapToolShapeRegistry() SIP_SKIP;
201 
206  static QgsHistoryProviderRegistry *historyProviderRegistry() SIP_KEEPREFERENCE;
207 
212  static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
213 
219  static QgsWindowManagerInterface *windowManager();
220 
226  static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
227 
232  enum HigFlag
233  {
234  HigMenuTextIsTitleCase = 1 << 0,
235  HigDialogTitleIsTitleCase = 1 << 1
236  };
237  Q_DECLARE_FLAGS( HigFlags, HigFlag )
238 
239 
243  static QgsGui::HigFlags higFlags();
244 
245  ~QgsGui();
246 
252  static QColor sampleColor( QPoint point );
253 
259  static QScreen *findScreenAt( QPoint point );
260 
270  static bool pythonMacroAllowed( void ( *lambda )() = nullptr, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
271 
273  void emitOptionsChanged() SIP_SKIP;
275 
276  signals:
277 
288  void optionsChanged();
289 
290  private:
291 
292  QgsGui();
293 
294  QgsSettingsRegistryGui *mSettingsRegistryGui = nullptr;
295  QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
296  QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
297  QgsNative *mNative = nullptr;
298  QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
299  QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
300  QgsShortcutsManager *mShortcutsManager = nullptr;
301  QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
302  QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
303  QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
304  QgsAnnotationItemGuiRegistry *mAnnotationItemGuiRegistry = nullptr;
305  QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
306  QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
307  QgsNumericFormatGuiRegistry *mNumericFormatGuiRegistry = nullptr;
308  QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
309  QgsCodeEditorColorSchemeRegistry *mCodeEditorColorSchemeRegistry = nullptr;
310  QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
311  QgsSubsetStringEditorProviderRegistry *mSubsetStringEditorProviderRegistry = nullptr;
312  QgsProviderSourceWidgetProviderRegistry *mProviderSourceWidgetProviderRegistry = nullptr;
313  QgsRelationWidgetRegistry *mRelationEditorRegistry = nullptr;
314  QgsMapToolShapeRegistry *mShapeMapToolRegistry = nullptr;
315  QgsHistoryProviderRegistry *mHistoryProviderRegistry = nullptr;
316  std::unique_ptr< QgsWindowManagerInterface > mWindowManager;
317 
318 #ifdef SIP_RUN
319  QgsGui( const QgsGui &other );
320 #endif
321 
322 };
323 
324 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsGui::HigFlags )
325 
326 #endif // QGSGUI_H
QgsDataItemGuiProviderRegistry
This class keeps a list of data item GUI providers that may affect how QgsDataItems behave within the...
Definition: qgsdataitemguiproviderregistry.h:37
QgsSourceSelectProviderRegistry
This class keeps a list of source select providers that may add items to the QgsDataSourceManagerDial...
Definition: qgssourceselectproviderregistry.h:41
QgsCodeEditorColorSchemeRegistry
A registry of color schemes for use in QgsCodeEditor widgets.
Definition: qgscodeeditorcolorschemeregistry.h:35
QgsAnnotationItemGuiRegistry
Registry of available annotation item GUI behavior.
Definition: qgsannotationitemguiregistry.h:304
QgsWidgetStateHelper
QgsWidgetStateHelper is a helper class to save and restore the geometry of QWidgets in the applicatio...
Definition: qgswidgetstatehelper_p.h:32
SIP_KEEPREFERENCE
#define SIP_KEEPREFERENCE
Definition: qgis_sip.h:86
QgsShortcutsManager
Shortcuts manager is a class that contains a list of QActions and QShortcuts that have been registere...
Definition: qgsshortcutsmanager.h:37
geos::unique_ptr
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsGui::ProjectCrsBehavior
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition: qgsgui.h:66
QgsMapToolShapeRegistry
Keeps track of the registered shape map tools.
Definition: qgsmaptoolshaperegistry.h:35
QgsHistoryProviderRegistry
The QgsHistoryProviderRegistry is a registry for objects which track user history (i....
Definition: qgshistoryproviderregistry.h:89
QgsMapLayerActionRegistry
This class tracks map layer actions.
Definition: qgsmaplayeractionregistry.h:149
QgsGui::HigFlag
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition: qgsgui.h:232
QgsLayerTreeEmbeddedWidgetRegistry
Registry of widgets that may be embedded into layer tree view. Embedded widgets are assigned per indi...
Definition: qgslayertreeembeddedwidgetregistry.h:70
qgis_sip.h
QgsRelationWidgetRegistry
Keeps track of the registered relations widgets.
Definition: qgsrelationwidgetregistry.h:31
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:60
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QgsProviderGuiRegistry
A registry / canonical manager of GUI parts of data providers.
Definition: qgsproviderguiregistry.h:53
QgsSubsetStringEditorProviderRegistry
This class keeps a list of subset string editor providers.
Definition: qgssubsetstringeditorproviderregistry.h:39
QgsProviderSourceWidgetProviderRegistry
This class keeps a list of provider source widget providers.
Definition: qgsprovidersourcewidgetproviderregistry.h:39
QgsProcessingGuiRegistry
The QgsProcessingGuiRegistry is a home for widgets for processing configuration widgets.
Definition: qgsprocessingguiregistry.h:44
QgsSettingsRegistryGui
QgsSettingsRegistryGui is used for settings introspection and collects all QgsSettingsEntry instances...
Definition: qgssettingsregistrygui.h:33
QgsNumericFormatGuiRegistry
The QgsNumericFormatGuiRegistry is a home for widgets for configuring QgsNumericFormat objects.
Definition: qgsnumericformatguiregistry.h:55
QgsProjectStorageGuiRegistry
A registry / canonical manager of GUI parts of project storage backends.
Definition: qgsprojectstorageguiregistry.h:44
QgsEditorWidgetRegistry
This class manages all known edit widget factories.
Definition: qgseditorwidgetregistry.h:44
QgsGui
QgsGui is a singleton class containing various registry and other global members related to GUI class...
Definition: qgsgui.h:57
QgsLayoutItemGuiRegistry
Registry of available layout item GUI behavior.
Definition: qgslayoutitemguiregistry.h:360