QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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;
40 class QgsMessageBar;
41 
48 class GUI_EXPORT QgsGui : public QObject
49 {
50  Q_OBJECT
51 
52  public:
53 
58  {
59  UseCrsOfFirstLayerAdded = 1,
60  UsePresetCrs = 2,
61  };
62  Q_ENUM( ProjectCrsBehavior )
63 
64 
65  QgsGui( const QgsGui &other ) = delete;
66 
68  QgsGui &operator=( const QgsGui &other ) = delete;
69 
73  static QgsGui *instance();
74 
80  SIP_SKIP static QgsNative *nativePlatformInterface();
81 
85  static QgsEditorWidgetRegistry *editorWidgetRegistry() SIP_KEEPREFERENCE;
86 
90  static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry() SIP_KEEPREFERENCE;
91 
95  static QgsShortcutsManager *shortcutsManager();
96 
100  static QgsLayerTreeEmbeddedWidgetRegistry *layerTreeEmbeddedWidgetRegistry() SIP_KEEPREFERENCE;
101 
105  static QgsMapLayerActionRegistry *mapLayerActionRegistry() SIP_KEEPREFERENCE;
106 
110  static QgsLayoutItemGuiRegistry *layoutItemGuiRegistry() SIP_KEEPREFERENCE;
111 
116  static QgsProcessingGuiRegistry *processingGuiRegistry() SIP_KEEPREFERENCE;
117 
122  static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
123 
129  static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() SIP_KEEPREFERENCE;
130 
135  static QgsProjectStorageGuiRegistry *projectStorageGuiRegistry() SIP_KEEPREFERENCE;
136 
141  static QgsProviderGuiRegistry *providerGuiRegistry() SIP_KEEPREFERENCE;
142 
147  static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
148 
154  static QgsWindowManagerInterface *windowManager();
155 
161  static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
162 
167  enum HigFlag
168  {
169  HigMenuTextIsTitleCase = 1 << 0,
170  HigDialogTitleIsTitleCase = 1 << 1
171  };
172  Q_DECLARE_FLAGS( HigFlags, HigFlag )
173 
174 
178  static QgsGui::HigFlags higFlags();
179 
180  ~QgsGui();
181 
187  static QColor sampleColor( QPoint point );
188 
194  static QScreen *findScreenAt( QPoint point );
195 
205  static bool pythonMacroAllowed( void ( *lambda )() = nullptr, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
206 
207  private:
208 
209  QgsGui();
210 
211  QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
212  QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
213  QgsNative *mNative = nullptr;
214  QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
215  QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
216  QgsShortcutsManager *mShortcutsManager = nullptr;
217  QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
218  QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
219  QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
220  QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
221  QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
222  QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
223  QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
224  std::unique_ptr< QgsWindowManagerInterface > mWindowManager;
225 
226 #ifdef SIP_RUN
227  QgsGui( const QgsGui &other );
228 #endif
229 
230 };
231 
232 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsGui::HigFlags )
233 
234 #endif // QGSGUI_H
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:48
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:45
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:167
QgsWidgetStateHelper is a helper class to save and restore the geometry of QWidgets in the applicatio...
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition: qgsgui.h:57
A registry / canonical manager of GUI parts of data providers.