QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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
QgsDataItemGuiProviderRegistry
Definition: qgsdataitemguiproviderregistry.h:37
QgsSourceSelectProviderRegistry
Definition: qgssourceselectproviderregistry.h:41
QgsWidgetStateHelper
Definition: qgswidgetstatehelper_p.h:32
SIP_KEEPREFERENCE
#define SIP_KEEPREFERENCE
Definition: qgis_sip.h:86
QgsShortcutsManager
Definition: qgsshortcutsmanager.h:37
geos::unique_ptr
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsGui::ProjectCrsBehavior
ProjectCrsBehavior
Defines the behavior to use when setting the CRS for a newly created project.
Definition: qgsgui.h:58
QgsMapLayerActionRegistry
Definition: qgsmaplayeractionregistry.h:145
QgsGui::HigFlag
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition: qgsgui.h:174
QgsLayerTreeEmbeddedWidgetRegistry
Definition: qgslayertreeembeddedwidgetregistry.h:70
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsMessageBar
Definition: qgsmessagebar.h:60
QgsProviderGuiRegistry
Definition: qgsproviderguiregistry.h:49
QgsProcessingGuiRegistry
The QgsProcessingGuiRegistry is a home for widgets for processing configuration widgets.
Definition: qgsprocessingguiregistry.h:44
QgsNumericFormatGuiRegistry
The QgsNumericFormatGuiRegistry is a home for widgets for configuring QgsNumericFormat objects.
Definition: qgsnumericformatguiregistry.h:55
QgsProjectStorageGuiRegistry
Definition: qgsprojectstorageguiregistry.h:44
QgsEditorWidgetRegistry
Definition: qgseditorwidgetregistry.h:44
QgsGui
Definition: qgsgui.h:49
QgsLayoutItemGuiRegistry
Registry of available layout item GUI behavior.
Definition: qgslayoutitemguiregistry.h:331