QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsGui Class Reference

QgsGui is a singleton class containing various registry and other global members related to GUI classes. More...

#include <qgsgui.h>

Inheritance diagram for QgsGui:
Inheritance graph
[legend]

Public Types

enum  HigFlag { HigMenuTextIsTitleCase = 1 << 0, HigDialogTitleIsTitleCase = 1 << 1 }
 HIG flags, which indicate the Human Interface Guidelines for the current platform. More...
 
enum  ProjectCrsBehavior { UseCrsOfFirstLayerAdded = 1, UsePresetCrs = 2 }
 Defines the behavior to use when setting the CRS for a newly created project. More...
 

Public Member Functions

 QgsGui (const QgsGui &other)=delete
 QgsGui cannot be copied. More...
 
 ~QgsGui ()
 
QgsGuioperator= (const QgsGui &other)=delete
 QgsGui cannot be copied. More...
 

Static Public Member Functions

static QgsDataItemGuiProviderRegistrydataItemGuiProviderRegistry ()
 Returns the global data item GUI provider registry, used for tracking providers which affect the browser GUI. More...
 
static QgsEditorWidgetRegistryeditorWidgetRegistry ()
 Returns the global editor widget registry, used for managing all known edit widget factories. More...
 
static void enableAutoGeometryRestore (QWidget *widget, const QString &key=QString())
 Register the widget to allow its position to be automatically saved and restored when open and closed. More...
 
static QScreen * findScreenAt (QPoint point)
 Returns the screen at the given global point (pixel). More...
 
static QgsGui::HigFlags higFlags ()
 Returns the platform's HIG flags. More...
 
static QgsGuiinstance ()
 Returns a pointer to the singleton instance. More...
 
static QgsLayerTreeEmbeddedWidgetRegistrylayerTreeEmbeddedWidgetRegistry ()
 Returns the global layer tree embedded widget registry, used for registering widgets that may be embedded into layer tree view. More...
 
static QgsLayoutItemGuiRegistrylayoutItemGuiRegistry ()
 Returns the global layout item GUI registry, used for registering the GUI behavior of layout items. More...
 
static QgsMapLayerActionRegistrymapLayerActionRegistry ()
 Returns the global map layer action registry, used for registering map layer actions. More...
 
static QgsNative * nativePlatformInterface ()
 Returns the global native interface, which offers abstraction to the host OS's underlying public interfaces. More...
 
static QgsProcessingGuiRegistryprocessingGuiRegistry ()
 Returns the global processing gui registry, used for registering the GUI behavior of processing algorithms. More...
 
static QgsProcessingRecentAlgorithmLog * processingRecentAlgorithmLog ()
 Returns the global processing recent algorithm log, used for tracking recently used processing algorithms. More...
 
static QgsProjectStorageGuiRegistryprojectStorageGuiRegistry ()
 Returns the global GUI-related project storage registry. More...
 
static QgsProviderGuiRegistryproviderGuiRegistry ()
 Returns the registry of GUI-related components of data providers. More...
 
static bool pythonMacroAllowed (void(*lambda)()=nullptr, QgsMessageBar *messageBar=nullptr)
 Returns true if python macros are currently allowed to be run If the global option is to ask user, a modal dialog will be shown. More...
 
static QColor sampleColor (QPoint point)
 Samples the color on screen at the specified global point (pixel). More...
 
static void setWindowManager (QgsWindowManagerInterface *manager)
 Sets the global window manager. More...
 
static QgsShortcutsManagershortcutsManager ()
 Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences. More...
 
static QgsSourceSelectProviderRegistrysourceSelectProviderRegistry ()
 Returns the global source select provider registry, used for managing all known source select widget factories. More...
 
static QgsWindowManagerInterface * windowManager ()
 Returns the global window manager, if set. More...
 

Detailed Description

QgsGui is a singleton class containing various registry and other global members related to GUI classes.

Since
QGIS 3.0

Definition at line 48 of file qgsgui.h.

Member Enumeration Documentation

◆ HigFlag

HIG flags, which indicate the Human Interface Guidelines for the current platform.

Since
QGIS 3.4
Enumerator
HigMenuTextIsTitleCase 

Menu action texts should be title case.

HigDialogTitleIsTitleCase 

Dialog titles should be title case.

Definition at line 167 of file qgsgui.h.

◆ ProjectCrsBehavior

Defines the behavior to use when setting the CRS for a newly created project.

Enumerator
UseCrsOfFirstLayerAdded 

Set the project CRS to the CRS of the first layer added to a new project.

UsePresetCrs 

Always set new projects to use a preset default CRS.

Definition at line 57 of file qgsgui.h.

Constructor & Destructor Documentation

◆ QgsGui()

QgsGui::QgsGui ( const QgsGui other)
delete

QgsGui cannot be copied.

◆ ~QgsGui()

QgsGui::~QgsGui ( )

Definition at line 159 of file qgsgui.cpp.

Member Function Documentation

◆ dataItemGuiProviderRegistry()

QgsDataItemGuiProviderRegistry * QgsGui::dataItemGuiProviderRegistry ( )
static

Returns the global data item GUI provider registry, used for tracking providers which affect the browser GUI.

Since
QGIS 3.6

Definition at line 112 of file qgsgui.cpp.

◆ editorWidgetRegistry()

QgsEditorWidgetRegistry * QgsGui::editorWidgetRegistry ( )
static

Returns the global editor widget registry, used for managing all known edit widget factories.

Definition at line 72 of file qgsgui.cpp.

◆ enableAutoGeometryRestore()

void QgsGui::enableAutoGeometryRestore ( QWidget *  widget,
const QString &  key = QString() 
)
static

Register the widget to allow its position to be automatically saved and restored when open and closed.

Use this to avoid needing to call saveGeometry() and restoreGeometry() on your widget.

Definition at line 127 of file qgsgui.cpp.

◆ findScreenAt()

QScreen * QgsGui::findScreenAt ( QPoint  point)
static

Returns the screen at the given global point (pixel).

Since
QGIS 3.10

Definition at line 188 of file qgsgui.cpp.

◆ higFlags()

QgsGui::HigFlags QgsGui::higFlags ( )
static

Returns the platform's HIG flags.

Since
QGIS 3.4

Definition at line 146 of file qgsgui.cpp.

◆ instance()

QgsGui * QgsGui::instance ( )
static

Returns a pointer to the singleton instance.

Definition at line 61 of file qgsgui.cpp.

◆ layerTreeEmbeddedWidgetRegistry()

QgsLayerTreeEmbeddedWidgetRegistry * QgsGui::layerTreeEmbeddedWidgetRegistry ( )
static

Returns the global layer tree embedded widget registry, used for registering widgets that may be embedded into layer tree view.

Definition at line 87 of file qgsgui.cpp.

◆ layoutItemGuiRegistry()

QgsLayoutItemGuiRegistry * QgsGui::layoutItemGuiRegistry ( )
static

Returns the global layout item GUI registry, used for registering the GUI behavior of layout items.

Definition at line 97 of file qgsgui.cpp.

◆ mapLayerActionRegistry()

QgsMapLayerActionRegistry * QgsGui::mapLayerActionRegistry ( )
static

Returns the global map layer action registry, used for registering map layer actions.

Definition at line 92 of file qgsgui.cpp.

◆ nativePlatformInterface()

QgsNative * QgsGui::nativePlatformInterface ( )
static

Returns the global native interface, which offers abstraction to the host OS's underlying public interfaces.

Note
Not available in Python bindings

Definition at line 67 of file qgsgui.cpp.

◆ operator=()

QgsGui& QgsGui::operator= ( const QgsGui other)
delete

QgsGui cannot be copied.

◆ processingGuiRegistry()

QgsProcessingGuiRegistry * QgsGui::processingGuiRegistry ( )
static

Returns the global processing gui registry, used for registering the GUI behavior of processing algorithms.

Since
QGIS 3.2

Definition at line 102 of file qgsgui.cpp.

◆ processingRecentAlgorithmLog()

QgsProcessingRecentAlgorithmLog * QgsGui::processingRecentAlgorithmLog ( )
static

Returns the global processing recent algorithm log, used for tracking recently used processing algorithms.

Since
QGIS 3.4

Definition at line 107 of file qgsgui.cpp.

◆ projectStorageGuiRegistry()

QgsProjectStorageGuiRegistry * QgsGui::projectStorageGuiRegistry ( )
static

Returns the global GUI-related project storage registry.

Since
QGIS 3.10

Definition at line 117 of file qgsgui.cpp.

◆ providerGuiRegistry()

QgsProviderGuiRegistry * QgsGui::providerGuiRegistry ( )
static

Returns the registry of GUI-related components of data providers.

Since
QGIS 3.10

Definition at line 122 of file qgsgui.cpp.

◆ pythonMacroAllowed()

bool QgsGui::pythonMacroAllowed ( void(*)()  lambda = nullptr,
QgsMessageBar messageBar = nullptr 
)
static

Returns true if python macros are currently allowed to be run If the global option is to ask user, a modal dialog will be shown.

Parameters
lambdaa pointer to a lambda method. If specified, the dialog is not modal, a message is shown with a button to enable macro. The lambda will be run either if macros are currently allowed or if the user accepts the message. The messageBar must be given in such case.
messageBarthe message bar must be provided if a lambda method is used.

Definition at line 239 of file qgsgui.cpp.

◆ sampleColor()

QColor QgsGui::sampleColor ( QPoint  point)
static

Samples the color on screen at the specified global point (pixel).

Since
QGIS 3.10

Definition at line 176 of file qgsgui.cpp.

◆ setWindowManager()

void QgsGui::setWindowManager ( QgsWindowManagerInterface *  manager)
static

Sets the global window manager.

Ownership is transferred to the QgsGui instance.

See also
windowManager()
Since
QGIS 3.4

Definition at line 141 of file qgsgui.cpp.

◆ shortcutsManager()

QgsShortcutsManager * QgsGui::shortcutsManager ( )
static

Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.

Definition at line 82 of file qgsgui.cpp.

◆ sourceSelectProviderRegistry()

QgsSourceSelectProviderRegistry * QgsGui::sourceSelectProviderRegistry ( )
static

Returns the global source select provider registry, used for managing all known source select widget factories.

Definition at line 77 of file qgsgui.cpp.

◆ windowManager()

QgsWindowManagerInterface * QgsGui::windowManager ( )
static

Returns the global window manager, if set.

See also
setWindowManager()
Since
QGIS 3.4

Definition at line 136 of file qgsgui.cpp.


The documentation for this class was generated from the following files: