QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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;
43 
50 class GUI_EXPORT QgsGui : public QObject
51 {
52  Q_OBJECT
53 
54  public:
55 
60  {
61  UseCrsOfFirstLayerAdded = 1,
62  UsePresetCrs = 2,
63  };
64  Q_ENUM( ProjectCrsBehavior )
65 
66 
67  QgsGui( const QgsGui &other ) = delete;
68 
70  QgsGui &operator=( const QgsGui &other ) = delete;
71 
75  static QgsGui *instance();
76 
82  SIP_SKIP static QgsNative *nativePlatformInterface();
83 
87  static QgsEditorWidgetRegistry *editorWidgetRegistry() SIP_KEEPREFERENCE;
88 
92  static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry() SIP_KEEPREFERENCE;
93 
97  static QgsShortcutsManager *shortcutsManager();
98 
102  static QgsLayerTreeEmbeddedWidgetRegistry *layerTreeEmbeddedWidgetRegistry() SIP_KEEPREFERENCE;
103 
107  static QgsMapLayerActionRegistry *mapLayerActionRegistry() SIP_KEEPREFERENCE;
108 
112  static QgsLayoutItemGuiRegistry *layoutItemGuiRegistry() SIP_KEEPREFERENCE;
113 
118  static QgsProcessingGuiRegistry *processingGuiRegistry() SIP_KEEPREFERENCE;
119 
124  static QgsNumericFormatGuiRegistry *numericFormatGuiRegistry() SIP_KEEPREFERENCE;
125 
130  static QgsCodeEditorColorSchemeRegistry *codeEditorColorSchemeRegistry() SIP_KEEPREFERENCE;
131 
136  static QgsProcessingRecentAlgorithmLog *processingRecentAlgorithmLog();
137 
143  static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() SIP_KEEPREFERENCE;
144 
149  static QgsProjectStorageGuiRegistry *projectStorageGuiRegistry() SIP_KEEPREFERENCE;
150 
155  static QgsProviderGuiRegistry *providerGuiRegistry() SIP_KEEPREFERENCE;
156 
161  static void enableAutoGeometryRestore( QWidget *widget, const QString &key = QString() );
162 
168  static QgsWindowManagerInterface *windowManager();
169 
175  static void setWindowManager( QgsWindowManagerInterface *manager SIP_TRANSFER );
176 
181  enum HigFlag
182  {
183  HigMenuTextIsTitleCase = 1 << 0,
184  HigDialogTitleIsTitleCase = 1 << 1
185  };
186  Q_DECLARE_FLAGS( HigFlags, HigFlag )
187 
188 
192  static QgsGui::HigFlags higFlags();
193 
194  ~QgsGui();
195 
201  static QColor sampleColor( QPoint point );
202 
208  static QScreen *findScreenAt( QPoint point );
209 
219  static bool pythonMacroAllowed( void ( *lambda )() = nullptr, QgsMessageBar *messageBar = nullptr ) SIP_SKIP;
220 
222  void emitOptionsChanged() SIP_SKIP;
224 
225  signals:
226 
237  void optionsChanged();
238 
239  private:
240 
241  QgsGui();
242 
243  QgsProviderGuiRegistry *mProviderGuiRegistry = nullptr;
244  QgsWidgetStateHelper *mWidgetStateHelper = nullptr;
245  QgsNative *mNative = nullptr;
246  QgsEditorWidgetRegistry *mEditorWidgetRegistry = nullptr;
247  QgsSourceSelectProviderRegistry *mSourceSelectProviderRegistry = nullptr;
248  QgsShortcutsManager *mShortcutsManager = nullptr;
249  QgsLayerTreeEmbeddedWidgetRegistry *mLayerTreeEmbeddedWidgetRegistry = nullptr;
250  QgsMapLayerActionRegistry *mMapLayerActionRegistry = nullptr;
251  QgsLayoutItemGuiRegistry *mLayoutItemGuiRegistry = nullptr;
252  QgsProcessingGuiRegistry *mProcessingGuiRegistry = nullptr;
253  QgsProcessingRecentAlgorithmLog *mProcessingRecentAlgorithmLog = nullptr;
254  QgsNumericFormatGuiRegistry *mNumericFormatGuiRegistry = nullptr;
255  QgsDataItemGuiProviderRegistry *mDataItemGuiProviderRegistry = nullptr;
256  QgsCodeEditorColorSchemeRegistry *mCodeEditorColorSchemeRegistry = nullptr;
257  QgsProjectStorageGuiRegistry *mProjectStorageGuiRegistry = nullptr;
258  std::unique_ptr< QgsWindowManagerInterface > mWindowManager;
259 
260 #ifdef SIP_RUN
261  QgsGui( const QgsGui &other );
262 #endif
263 
264 };
265 
266 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsGui::HigFlags )
267 
268 #endif // QGSGUI_H
QgsDataItemGuiProviderRegistry
This class keeps a list of data item GUI providers that may affect how QgsDataItems behave within the...
Definition: qgsdataitemguiproviderregistry.h:38
QgsSourceSelectProviderRegistry
This class keeps a list of source select providers that may add items to the QgsDataSourceManagerDial...
Definition: qgssourceselectproviderregistry.h:42
QgsCodeEditorColorSchemeRegistry
A registry of color schemes for use in QgsCodeEditor widgets.
Definition: qgscodeeditorcolorschemeregistry.h:36
QgsWidgetStateHelper
QgsWidgetStateHelper is a helper class to save and restore the geometry of QWidgets in the applicatio...
Definition: qgswidgetstatehelper_p.h:33
SIP_KEEPREFERENCE
#define SIP_KEEPREFERENCE
Definition: qgis_sip.h:86
QgsShortcutsManager
Shortcuts manager is a class that contains a list of QActions and QShortcuts that have been registere...
Definition: qgsshortcutsmanager.h:38
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:60
QgsMapLayerActionRegistry
This class tracks map layer actions.
Definition: qgsmaplayeractionregistry.h:146
QgsGui::HigFlag
HigFlag
HIG flags, which indicate the Human Interface Guidelines for the current platform.
Definition: qgsgui.h:182
QgsLayerTreeEmbeddedWidgetRegistry
Registry of widgets that may be embedded into layer tree view.
Definition: qgslayertreeembeddedwidgetregistry.h:71
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
Q_DECLARE_OPERATORS_FOR_FLAGS
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.
QgsProviderGuiRegistry
A registry / canonical manager of GUI parts of data providers.
Definition: qgsproviderguiregistry.h:50
QgsProcessingGuiRegistry
The QgsProcessingGuiRegistry is a home for widgets for processing configuration widgets.
Definition: qgsprocessingguiregistry.h:45
QgsNumericFormatGuiRegistry
The QgsNumericFormatGuiRegistry is a home for widgets for configuring QgsNumericFormat objects.
Definition: qgsnumericformatguiregistry.h:56
QgsProjectStorageGuiRegistry
A registry / canonical manager of GUI parts of project storage backends.
Definition: qgsprojectstorageguiregistry.h:45
QgsEditorWidgetRegistry
This class manages all known edit widget factories.
Definition: qgseditorwidgetregistry.h:45
QgsGui
QgsGui is a singleton class containing various registry and other global members related to GUI class...
Definition: qgsgui.h:51
QgsLayoutItemGuiRegistry
Registry of available layout item GUI behavior.
Definition: qgslayoutitemguiregistry.h:332