QGIS API Documentation  3.20.0-Odense (decaadbb31)
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;
46 
53 class GUI_EXPORT QgsGui : public QObject
54 {
55  Q_OBJECT
56 
57  public:
58 
63  {
64  UseCrsOfFirstLayerAdded = 1,
65  UsePresetCrs = 2,
66  };
67  Q_ENUM( ProjectCrsBehavior )
68 
69 
70  QgsGui( const QgsGui &other ) = delete;
71 
73  QgsGui &operator=( const QgsGui &other ) = delete;
74 
78  static QgsGui *instance();
79 
85  SIP_SKIP static QgsNative *nativePlatformInterface();
86 
90  static QgsEditorWidgetRegistry *editorWidgetRegistry() SIP_KEEPREFERENCE;
91 
95  static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry() SIP_KEEPREFERENCE;
96 
100  static QgsShortcutsManager *shortcutsManager();
101 
105  static QgsLayerTreeEmbeddedWidgetRegistry *layerTreeEmbeddedWidgetRegistry() SIP_KEEPREFERENCE;
106 
110  static QgsMapLayerActionRegistry *mapLayerActionRegistry() SIP_KEEPREFERENCE;
111 
115  static QgsLayoutItemGuiRegistry *layoutItemGuiRegistry() SIP_KEEPREFERENCE;
116 
121  static QgsProcessingGuiRegistry *processingGuiRegistry() SIP_KEEPREFERENCE;
122 
127  static QgsNumericFormatGuiRegistry *numericFormatGuiRegistry() SIP_KEEPREFERENCE;
128 
133  static QgsCodeEditorColorSchemeRegistry *codeEditorColorSchemeRegistry() SIP_KEEPREFERENCE;
134 
139  static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
140 
146  static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() SIP_KEEPREFERENCE;
147 
152  static QgsProjectStorageGuiRegistry *projectStorageGuiRegistry() SIP_KEEPREFERENCE;
153 
158  static QgsProviderGuiRegistry *providerGuiRegistry() SIP_KEEPREFERENCE;
159 
164  static QgsSubsetStringEditorProviderRegistry *subsetStringEditorProviderRegistry() SIP_KEEPREFERENCE;
165 
170  static QgsProviderSourceWidgetProviderRegistry *sourceWidgetProviderRegistry() SIP_KEEPREFERENCE;
171 
176  static QgsRelationWidgetRegistry *relationWidgetRegistry() SIP_KEEPREFERENCE;
177 
182  static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
183 
189  static QgsWindowManagerInterface *windowManager();
190 
196  static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
197 
202  enum HigFlag
203  {
204  HigMenuTextIsTitleCase = 1 << 0,
205  HigDialogTitleIsTitleCase = 1 << 1
206  };
207  Q_DECLARE_FLAGS( HigFlags, HigFlag )
208 
209 
213  static QgsGui::HigFlags higFlags();
214 
215  ~QgsGui();
216 
222  static QColor sampleColor( QPoint point );
223 
229  static QScreen *findScreenAt( QPoint point );
230 
240  static bool pythonMacroAllowed( void ( *lambda )() = nullptr, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
241 
243  void emitOptionsChanged() SIP_SKIP;
245 
246  signals:
247 
258  void optionsChanged();
259 
260  private:
261 
262  QgsGui();
263 
264  QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
265  QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
266  QgsNative *mNative = nullptr;
267  QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
268  QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
269  QgsShortcutsManager *mShortcutsManager = nullptr;
270  QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
271  QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
272  QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
273  QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
274  QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
275  QgsNumericFormatGuiRegistry *mNumericFormatGuiRegistry = nullptr;
276  QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
277  QgsCodeEditorColorSchemeRegistry *mCodeEditorColorSchemeRegistry = nullptr;
278  QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
279  QgsSubsetStringEditorProviderRegistry *mSubsetStringEditorProviderRegistry = nullptr;
280  QgsProviderSourceWidgetProviderRegistry *mProviderSourceWidgetProviderRegistry = nullptr;
281  QgsRelationWidgetRegistry *mRelationEditorRegistry = nullptr;
282  std::unique_ptr< QgsWindowManagerInterface > mWindowManager;
283 
284 #ifdef SIP_RUN
285  QgsGui( const QgsGui &other );
286 #endif
287 
288 };
289 
290 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsGui::HigFlags )
291 
292 #endif // QGSGUI_H
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:54
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition: qgsgui.h:203
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition: qgsgui.h:63
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.
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.