QGIS API Documentation  3.17.0-Master (8af46bc54f)
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 
31 class QgsNative;
35 class QgsProcessingRecentAlgorithmLog;
36 class QgsWindowManagerInterface;
42 class QgsMessageBar;
44 
51 class GUI_EXPORT QgsGui : public QObject
52 {
53  Q_OBJECT
54 
55  public:
56 
61  {
62  UseCrsOfFirstLayerAdded = 1,
63  UsePresetCrs = 2,
64  };
65  Q_ENUM( ProjectCrsBehavior )
66 
67 
68  QgsGui( const QgsGui &other ) = delete;
69 
71  QgsGui &operator=( const QgsGui &other ) = delete;
72 
76  static QgsGui *instance();
77 
83  SIP_SKIP static QgsNative *nativePlatformInterface();
84 
88  static QgsEditorWidgetRegistry *editorWidgetRegistry() SIP_KEEPREFERENCE;
89 
93  static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry() SIP_KEEPREFERENCE;
94 
98  static QgsShortcutsManager *shortcutsManager();
99 
103  static QgsLayerTreeEmbeddedWidgetRegistry *layerTreeEmbeddedWidgetRegistry() SIP_KEEPREFERENCE;
104 
108  static QgsMapLayerActionRegistry *mapLayerActionRegistry() SIP_KEEPREFERENCE;
109 
113  static QgsLayoutItemGuiRegistry *layoutItemGuiRegistry() SIP_KEEPREFERENCE;
114 
119  static QgsProcessingGuiRegistry *processingGuiRegistry() SIP_KEEPREFERENCE;
120 
125  static QgsNumericFormatGuiRegistry *numericFormatGuiRegistry() SIP_KEEPREFERENCE;
126 
131  static QgsCodeEditorColorSchemeRegistry *codeEditorColorSchemeRegistry() SIP_KEEPREFERENCE;
132 
137  static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
138 
144  static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() SIP_KEEPREFERENCE;
145 
150  static QgsProjectStorageGuiRegistry *projectStorageGuiRegistry() SIP_KEEPREFERENCE;
151 
156  static QgsProviderGuiRegistry *providerGuiRegistry() SIP_KEEPREFERENCE;
157 
162  static QgsSubsetStringEditorProviderRegistry *subsetStringEditorProviderRegistry() SIP_KEEPREFERENCE;
163 
168  static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
169 
175  static QgsWindowManagerInterface *windowManager();
176 
182  static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
183 
188  enum HigFlag
189  {
190  HigMenuTextIsTitleCase = 1 << 0,
191  HigDialogTitleIsTitleCase = 1 << 1
192  };
193  Q_DECLARE_FLAGS( HigFlags, HigFlag )
194 
195 
199  static QgsGui::HigFlags higFlags();
200 
201  ~QgsGui();
202 
208  static QColor sampleColor( QPoint point );
209 
215  static QScreen *findScreenAt( QPoint point );
216 
226  static bool pythonMacroAllowed( void ( *lambda )() = nullptr, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
227 
229  void emitOptionsChanged() SIP_SKIP;
231 
232  signals:
233 
244  void optionsChanged();
245 
246  private:
247 
248  QgsGui();
249 
250  QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
251  QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
252  QgsNative *mNative = nullptr;
253  QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
254  QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
255  QgsShortcutsManager *mShortcutsManager = nullptr;
256  QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
257  QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
258  QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
259  QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
260  QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
261  QgsNumericFormatGuiRegistry *mNumericFormatGuiRegistry = nullptr;
262  QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
263  QgsCodeEditorColorSchemeRegistry *mCodeEditorColorSchemeRegistry = nullptr;
264  QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
265  QgsSubsetStringEditorProviderRegistry *mSubsetStringEditorProviderRegistry = nullptr;
266  std::unique_ptr< QgsWindowManagerInterface > mWindowManager;
267 
268 #ifdef SIP_RUN
269  QgsGui( const QgsGui &other );
270 #endif
271 
272 };
273 
274 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsGui::HigFlags )
275 
276 #endif // QGSGUI_H
The QgsNumericFormatGuiRegistry is a home for widgets for configuring QgsNumericFormat objects...
A registry / canonical manager of GUI parts of project storage backends.
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:51
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.
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:60
This class keeps a list of subset string editor providers.
Shortcuts manager is a class that contains a list of QActions and QShortcuts that have been registere...
The QgsProcessingGuiRegistry is a home for widgets for processing configuration widgets.
Registry of available layout item GUI behavior.
#define SIP_SKIP
Definition: qgis_sip.h:126
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_KEEPREFERENCE
Definition: qgis_sip.h:86
Registry of widgets that may be embedded into layer tree view.
This class tracks map layer actions.
This class keeps a list of source select providers that may add items to the QgsDataSourceManagerDial...
This class keeps a list of data item GUI providers that may affect how QgsDataItems behave within the...
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition: qgsgui.h:188
QgsWidgetStateHelper is a helper class to save and restore the geometry of QWidgets in the applicatio...
A registry of color schemes for use in QgsCodeEditor widgets.
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition: qgsgui.h:60
A registry / canonical manager of GUI parts of data providers.