QGIS API Documentation  3.23.0-Master (7c4a6de034)
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;
49 
56 class GUI_EXPORT QgsGui : public QObject
57 {
58  Q_OBJECT
59 
60  public:
61 
66  {
67  UseCrsOfFirstLayerAdded = 1,
68  UsePresetCrs = 2,
69  };
70  Q_ENUM( ProjectCrsBehavior )
71 
72 
73  QgsGui( const QgsGui &other ) = delete;
74 
76  QgsGui &operator=( const QgsGui &other ) = delete;
77 
81  static QgsGui *instance();
82 
88  SIP_SKIP static QgsNative *nativePlatformInterface();
89 
94  static QgsSettingsRegistryGui *settingsRegistryGui() SIP_KEEPREFERENCE;
95 
99  static QgsEditorWidgetRegistry *editorWidgetRegistry() SIP_KEEPREFERENCE;
100 
104  static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry() SIP_KEEPREFERENCE;
105 
109  static QgsShortcutsManager *shortcutsManager();
110 
114  static QgsLayerTreeEmbeddedWidgetRegistry *layerTreeEmbeddedWidgetRegistry() SIP_KEEPREFERENCE;
115 
119  static QgsMapLayerActionRegistry *mapLayerActionRegistry() SIP_KEEPREFERENCE;
120 
124  static QgsLayoutItemGuiRegistry *layoutItemGuiRegistry() SIP_KEEPREFERENCE;
125 
131  static QgsAnnotationItemGuiRegistry *annotationItemGuiRegistry() SIP_KEEPREFERENCE;
132 
137  static QgsProcessingGuiRegistry *processingGuiRegistry() SIP_KEEPREFERENCE;
138 
143  static QgsNumericFormatGuiRegistry *numericFormatGuiRegistry() SIP_KEEPREFERENCE;
144 
149  static QgsCodeEditorColorSchemeRegistry *codeEditorColorSchemeRegistry() SIP_KEEPREFERENCE;
150 
155  static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
156 
162  static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() SIP_KEEPREFERENCE;
163 
168  static QgsProjectStorageGuiRegistry *projectStorageGuiRegistry() SIP_KEEPREFERENCE;
169 
174  static QgsProviderGuiRegistry *providerGuiRegistry() SIP_KEEPREFERENCE;
175 
180  static QgsSubsetStringEditorProviderRegistry *subsetStringEditorProviderRegistry() SIP_KEEPREFERENCE;
181 
186  static QgsProviderSourceWidgetProviderRegistry *sourceWidgetProviderRegistry() SIP_KEEPREFERENCE;
187 
192  static QgsRelationWidgetRegistry *relationWidgetRegistry() SIP_KEEPREFERENCE;
193 
194 
199  static QgsHistoryProviderRegistry *historyProviderRegistry() SIP_KEEPREFERENCE;
200 
205  static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
206 
212  static QgsWindowManagerInterface *windowManager();
213 
219  static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
220 
225  enum HigFlag
226  {
227  HigMenuTextIsTitleCase = 1 << 0,
228  HigDialogTitleIsTitleCase = 1 << 1
229  };
230  Q_DECLARE_FLAGS( HigFlags, HigFlag )
231 
232 
236  static QgsGui::HigFlags higFlags();
237 
238  ~QgsGui();
239 
245  static QColor sampleColor( QPoint point );
246 
252  static QScreen *findScreenAt( QPoint point );
253 
263  static bool pythonMacroAllowed( void ( *lambda )() = nullptr, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
264 
266  void emitOptionsChanged() SIP_SKIP;
268 
269  signals:
270 
281  void optionsChanged();
282 
283  private:
284 
285  QgsGui();
286 
287  QgsSettingsRegistryGui *mSettingsRegistryGui = nullptr;
288  QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
289  QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
290  QgsNative *mNative = nullptr;
291  QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
292  QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
293  QgsShortcutsManager *mShortcutsManager = nullptr;
294  QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
295  QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
296  QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
297  QgsAnnotationItemGuiRegistry *mAnnotationItemGuiRegistry = nullptr;
298  QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
299  QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
300  QgsNumericFormatGuiRegistry *mNumericFormatGuiRegistry = nullptr;
301  QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
302  QgsCodeEditorColorSchemeRegistry *mCodeEditorColorSchemeRegistry = nullptr;
303  QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
304  QgsSubsetStringEditorProviderRegistry *mSubsetStringEditorProviderRegistry = nullptr;
305  QgsProviderSourceWidgetProviderRegistry *mProviderSourceWidgetProviderRegistry = nullptr;
306  QgsRelationWidgetRegistry *mRelationEditorRegistry = nullptr;
307  QgsHistoryProviderRegistry *mHistoryProviderRegistry = nullptr;
308  std::unique_ptr< QgsWindowManagerInterface > mWindowManager;
309 
310 #ifdef SIP_RUN
311  QgsGui( const QgsGui &other );
312 #endif
313 
314 };
315 
316 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsGui::HigFlags )
317 
318 #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:57
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition: qgsgui.h:226
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition: qgsgui.h:66
The QgsHistoryProviderRegistry is a registry for objects which track user history (i....
Registry of widgets that may be embedded into layer tree view.
Registry of available layout item GUI behavior.
This class tracks map layer actions.
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.
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:79
#define SIP_KEEPREFERENCE
Definition: qgis_sip.h:86
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36
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.