QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
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;
41 class QgsMessageBar;
42 
49 class GUI_EXPORT QgsGui : public QObject
50 {
51  Q_OBJECT
52 
53  public:
54 
59  {
60  UseCrsOfFirstLayerAdded = 1,
61  UsePresetCrs = 2,
62  };
63  Q_ENUM( ProjectCrsBehavior )
64 
65 
66  QgsGui( const QgsGui &other ) = delete;
67 
69  QgsGui &operator=( const QgsGui &other ) = delete;
70 
74  static QgsGui *instance();
75 
81  SIP_SKIP static QgsNative *nativePlatformInterface();
82 
86  static QgsEditorWidgetRegistry *editorWidgetRegistry() SIP_KEEPREFERENCE;
87 
91  static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry() SIP_KEEPREFERENCE;
92 
96  static QgsShortcutsManager *shortcutsManager();
97 
101  static QgsLayerTreeEmbeddedWidgetRegistry *layerTreeEmbeddedWidgetRegistry() SIP_KEEPREFERENCE;
102 
106  static QgsMapLayerActionRegistry *mapLayerActionRegistry() SIP_KEEPREFERENCE;
107 
111  static QgsLayoutItemGuiRegistry *layoutItemGuiRegistry() SIP_KEEPREFERENCE;
112 
117  static QgsProcessingGuiRegistry *processingGuiRegistry() SIP_KEEPREFERENCE;
118 
123  static QgsNumericFormatGuiRegistry *numericFormatGuiRegistry() SIP_KEEPREFERENCE;
124 
129  static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
130 
136  static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() SIP_KEEPREFERENCE;
137 
142  static QgsProjectStorageGuiRegistry *projectStorageGuiRegistry() SIP_KEEPREFERENCE;
143 
148  static QgsProviderGuiRegistry *providerGuiRegistry() SIP_KEEPREFERENCE;
149 
154  static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
155 
161  static QgsWindowManagerInterface *windowManager();
162 
168  static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
169 
174  enum HigFlag
175  {
176  HigMenuTextIsTitleCase = 1 << 0,
177  HigDialogTitleIsTitleCase = 1 << 1
178  };
179  Q_DECLARE_FLAGS( HigFlags, HigFlag )
180 
181 
185  static QgsGui::HigFlags higFlags();
186 
187  ~QgsGui();
188 
194  static QColor sampleColor( QPoint point );
195 
201  static QScreen *findScreenAt( QPoint point );
202 
212  static bool pythonMacroAllowed( void ( *lambda )() = nullptr, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
213 
214  private:
215 
216  QgsGui();
217 
218  QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
219  QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
220  QgsNative *mNative = nullptr;
221  QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
222  QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
223  QgsShortcutsManager *mShortcutsManager = nullptr;
224  QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
225  QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
226  QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
227  QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
228  QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
229  QgsNumericFormatGuiRegistry *mNumericFormatGuiRegistry = nullptr;
230  QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
231  QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
232  std::unique_ptr< QgsWindowManagerInterface > mWindowManager;
233 
234 #ifdef SIP_RUN
235  QgsGui( const QgsGui &other );
236 #endif
237 
238 };
239 
240 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsGui::HigFlags )
241 
242 #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:49
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:174
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:58
A registry / canonical manager of GUI parts of data providers.