QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsgui.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsgui.cpp
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
19#include <QScreen>
20#include <QMessageBox>
21
22#include "qgsgui.h"
23#include "moc_qgsgui.cpp"
31#include "qgscalloutsregistry.h"
33#ifdef Q_OS_MACOS
34#include "qgsmacnative.h"
35#elif defined( Q_OS_WIN )
36#ifndef __MINGW32__
37#include "qgswinnative.h"
38#else
39#include "qgsnative.h"
40#endif
41#elif defined( Q_OS_LINUX )
42#include "qgslinuxnative.h"
43#else
44#include "qgsnative.h"
45#endif
47#include "qgsshortcutsmanager.h"
49#include "qgslogger.h"
53#include "qgssettings.h"
57#include "qgsmessagebar.h"
58#include "qgsmessagebaritem.h"
70#include "qgshistoryentry.h"
71#include "qgsstacsourceselectprovider.h"
72
74
75
76#include <QPushButton>
77#include <QToolButton>
78
80{
81 static QgsGui *sInstance( new QgsGui() );
82 return sInstance;
83}
84
86{
87 return instance()->mNative;
88}
89
91{
92 return instance()->mSettingsRegistryGui;
93}
94
96{
97 return instance()->mEditorWidgetRegistry;
98}
99
101{
102 return instance()->mRelationEditorRegistry;
103}
104
106{
107 return instance()->mShapeMapToolRegistry;
108}
109
111{
112 return instance()->mSourceSelectProviderRegistry;
113}
114
116{
117 return instance()->mSubsetStringEditorProviderRegistry;
118}
119
121{
122 return instance()->mProviderSourceWidgetProviderRegistry;
123}
124
126{
127 return instance()->mShortcutsManager;
128}
129
131{
132 return instance()->mLayerTreeEmbeddedWidgetRegistry;
133}
134
136{
137 return instance()->mMapLayerActionRegistry;
138}
139
141{
142 return instance()->mLayoutItemGuiRegistry;
143}
144
146{
147 return instance()->mAnnotationItemGuiRegistry;
148}
149
151{
152 return instance()->mAdvancedDigitizingToolsRegistry;
153}
154
156{
157 return instance()->mProcessingGuiRegistry;
158}
159
161{
162 return instance()->mNumericFormatGuiRegistry;
163}
164
166{
167 return instance()->mCodeEditorColorSchemeRegistry;
168}
169
170QgsProcessingFavoriteAlgorithmManager *QgsGui::processingFavoriteAlgorithmManager()
171{
172 return instance()->mProcessingFavoriteAlgorithmManager;
173}
174
175QgsProcessingRecentAlgorithmLog *QgsGui::processingRecentAlgorithmLog()
176{
177 return instance()->mProcessingRecentAlgorithmLog;
178}
179
181{
182 return instance()->mDataItemGuiProviderRegistry;
183}
184
186{
187 return instance()->mProjectStorageGuiRegistry;
188}
189
191{
192 return instance()->mProviderGuiRegistry;
193}
194
196{
197 return instance()->mSensorGuiRegistry;
198}
199
201{
202 return instance()->mHistoryProviderRegistry;
203}
204
206{
207 return instance()->mSettingsEditorRegistry;
208}
209
210void QgsGui::enableAutoGeometryRestore( QWidget *widget, const QString &key )
211{
212 if ( widget->objectName().isEmpty() )
213 {
214 QgsDebugError( QStringLiteral( "WARNING: No object name set. Best for it to be set objectName when using QgsGui::enableAutoGeometryRestore" ) );
215 }
216 instance()->mWidgetStateHelper->registerWidget( widget, key );
217}
218
219QgsWindowManagerInterface *QgsGui::windowManager()
220{
221 return instance()->mWindowManager.get();
222}
223
225{
226 return instance()->mInputControllerManager;
227}
228
229void QgsGui::setWindowManager( QgsWindowManagerInterface *manager )
230{
231 instance()->mWindowManager.reset( manager );
232}
233
235{
236 if ( QgsApplication::settingsLocaleUserLocale->value().startsWith( QLatin1String( "en" ) ) )
237 {
239 }
240 else
241 {
242 return QgsGui::HigFlags();
243 }
244}
245
247{
248 delete mProcessingGuiRegistry;
249 delete mDataItemGuiProviderRegistry;
250 delete mProcessingFavoriteAlgorithmManager;
251 delete mProcessingRecentAlgorithmLog;
252 delete mLayoutItemGuiRegistry;
253 delete mAnnotationItemGuiRegistry;
254 delete mAdvancedDigitizingToolsRegistry;
255 delete mLayerTreeEmbeddedWidgetRegistry;
256 delete mEditorWidgetRegistry;
257 delete mMapLayerActionRegistry;
258 delete mSourceSelectProviderRegistry;
259 delete mHistoryProviderRegistry;
260 delete mShortcutsManager;
261 delete mNative;
262 delete mNumericFormatGuiRegistry;
263 delete mWidgetStateHelper;
264 delete mProjectStorageGuiRegistry;
265 delete mProviderGuiRegistry;
266 delete mCodeEditorColorSchemeRegistry;
267 delete mSubsetStringEditorProviderRegistry;
268 delete mProviderSourceWidgetProviderRegistry;
269 delete mShapeMapToolRegistry;
270 delete mRelationEditorRegistry;
271 delete mInputControllerManager;
272 delete mSettingsRegistryGui;
273 delete mSensorGuiRegistry;
274 delete mSettingsEditorRegistry;
275}
276
277QColor QgsGui::sampleColor( QPoint point )
278{
279 QScreen *screen = findScreenAt( point );
280 if ( !screen )
281 {
282 return QColor();
283 }
284
285 const int x = point.x() - screen->geometry().left();
286 const int y = point.y() - screen->geometry().top();
287 const QPixmap snappedPixmap = screen->grabWindow( 0, x, y, 1, 1 );
288 const QImage snappedImage = snappedPixmap.toImage();
289 return snappedImage.pixel( 0, 0 );
290}
291
292QScreen *QgsGui::findScreenAt( QPoint point )
293{
294 const QList<QScreen *> screens = QGuiApplication::screens();
295 for ( QScreen *screen : screens )
296 {
297 if ( screen->geometry().contains( point ) )
298 {
299 return screen;
300 }
301 }
302 return nullptr;
303}
304
305QgsGui::QgsGui()
306{
307#ifdef Q_OS_MAC
308 QgsMacNative *macNative = new QgsMacNative();
309 macNative->setIconPath( QgsApplication::iconsPath() + QStringLiteral( "qgis-icon-macos.png" ) );
310 mNative = macNative;
311#elif defined( Q_OS_WIN )
312#ifndef __MINGW32__
313 mNative = new QgsWinNative();
314#else
315 mNative = new QgsNative();
316#endif
317#elif defined( Q_OS_LINUX )
318 mNative = new QgsLinuxNative();
319#else
320 mNative = new QgsNative();
321#endif
322
323 mSettingsRegistryGui = new QgsSettingsRegistryGui();
324
325 mSettingsEditorRegistry = new QgsSettingsEditorWidgetRegistry();
326
327 mCodeEditorColorSchemeRegistry = new QgsCodeEditorColorSchemeRegistry();
328
329 // provider gui registry initialize QgsProviderRegistry too
330 mSensorGuiRegistry = new QgsSensorGuiRegistry();
331 mSensorGuiRegistry->populate();
332
333 mHistoryProviderRegistry = new QgsHistoryProviderRegistry();
334 mHistoryProviderRegistry->addDefaultProviders();
335
336 mInputControllerManager = new QgsInputControllerManager();
337
338 mProviderGuiRegistry = new QgsProviderGuiRegistry( QgsApplication::pluginPath() );
339 mProjectStorageGuiRegistry = new QgsProjectStorageGuiRegistry();
340 mDataItemGuiProviderRegistry = new QgsDataItemGuiProviderRegistry();
341 mSourceSelectProviderRegistry = new QgsSourceSelectProviderRegistry();
342 mNumericFormatGuiRegistry = new QgsNumericFormatGuiRegistry();
343 mSubsetStringEditorProviderRegistry = new QgsSubsetStringEditorProviderRegistry();
344 mProviderSourceWidgetProviderRegistry = new QgsProviderSourceWidgetProviderRegistry();
345
346 mProjectStorageGuiRegistry->initializeFromProviderGuiRegistry( mProviderGuiRegistry );
347 mDataItemGuiProviderRegistry->initializeFromProviderGuiRegistry( mProviderGuiRegistry );
348 mSourceSelectProviderRegistry->initializeFromProviderGuiRegistry( mProviderGuiRegistry );
349 mSourceSelectProviderRegistry->addProvider( new QgsLayerMetadataSourceSelectProvider() );
350 mSourceSelectProviderRegistry->addProvider( new QgsStacSourceSelectProvider() );
351 mSubsetStringEditorProviderRegistry->initializeFromProviderGuiRegistry( mProviderGuiRegistry );
352 mProviderSourceWidgetProviderRegistry->initializeFromProviderGuiRegistry( mProviderGuiRegistry );
353
354 mEditorWidgetRegistry = new QgsEditorWidgetRegistry();
355 mRelationEditorRegistry = new QgsRelationWidgetRegistry();
356 mShapeMapToolRegistry = new QgsMapToolShapeRegistry();
357 mShortcutsManager = new QgsShortcutsManager();
358 mLayerTreeEmbeddedWidgetRegistry = new QgsLayerTreeEmbeddedWidgetRegistry();
359 mMapLayerActionRegistry = new QgsMapLayerActionRegistry();
360 mLayoutItemGuiRegistry = new QgsLayoutItemGuiRegistry();
361
362 mAnnotationItemGuiRegistry = new QgsAnnotationItemGuiRegistry();
363 mAnnotationItemGuiRegistry->addDefaultItems();
364
365 mAdvancedDigitizingToolsRegistry = new QgsAdvancedDigitizingToolsRegistry();
366 mAdvancedDigitizingToolsRegistry->addDefaultTools();
367
368 mWidgetStateHelper = new QgsWidgetStateHelper();
369 mProcessingFavoriteAlgorithmManager = new QgsProcessingFavoriteAlgorithmManager();
370 mProcessingRecentAlgorithmLog = new QgsProcessingRecentAlgorithmLog();
371 mProcessingGuiRegistry = new QgsProcessingGuiRegistry();
372
373 qRegisterMetaType<QgsHistoryEntry>( "QgsHistoryEntry" );
374}
375
376bool QgsGui::pythonEmbeddedInProjectAllowed( void ( *lambda )(), QgsMessageBar *messageBar, Qgis::PythonEmbeddedType embeddedType )
377{
378 const Qgis::PythonEmbeddedMode pythonEmbeddedMode = QgsSettings().enumValue( QStringLiteral( "qgis/enablePythonEmbedded" ), Qgis::PythonEmbeddedMode::Ask );
379
380 switch ( pythonEmbeddedMode )
381 {
384 if ( embeddedType == Qgis::PythonEmbeddedType::Macro )
385 {
386 if ( lambda )
387 lambda();
388 }
389 // If this is the case, expression functions
390 // are loaded directly by the QGIS project.
391 return true;
394 if ( messageBar )
395 {
396 switch ( embeddedType )
397 {
399 messageBar->pushMessage( tr( "Python Macros" ), tr( "Python macros are currently disabled and will not be run" ), Qgis::MessageLevel::Warning );
400 break;
402 messageBar->pushMessage( tr( "Python Expressions" ), tr( "Python expressions from project are currently disabled and will not be loaded" ), Qgis::MessageLevel::Warning );
403 break;
404 }
405 }
406 return false;
408 if ( embeddedType == Qgis::PythonEmbeddedType::Macro )
409 {
410 if ( !lambda )
411 {
412 QMessageBox msgBox( QMessageBox::Information, tr( "Python Macros" ), tr( "Python macros are currently disabled. Do you allow this macro to run?" ) );
413 QAbstractButton *stopSessionButton = msgBox.addButton( tr( "Disable for this Session" ), QMessageBox::DestructiveRole );
414 msgBox.addButton( tr( "No" ), QMessageBox::NoRole );
415 QAbstractButton *yesButton = msgBox.addButton( tr( "Yes" ), QMessageBox::YesRole );
416 msgBox.exec();
417
418 QAbstractButton *clicked = msgBox.clickedButton();
419 if ( clicked == stopSessionButton )
420 {
421 QgsSettings().setEnumValue( QStringLiteral( "qgis/enablePythonEmbedded" ), Qgis::PythonEmbeddedMode::NotForThisSession );
422 }
423 return clicked == yesButton;
424 }
425 else
426 {
427 // create the notification widget for macros
428 Q_ASSERT( messageBar );
429 if ( messageBar )
430 {
431 QToolButton *btnEnableMacros = new QToolButton();
432 btnEnableMacros->setText( tr( "Enable Macros" ) );
433 btnEnableMacros->setStyleSheet( QStringLiteral( "background-color: rgba(255, 255, 255, 0); color: black; text-decoration: underline;" ) );
434 btnEnableMacros->setCursor( Qt::PointingHandCursor );
435 btnEnableMacros->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
436
437 QgsMessageBarItem *macroMsg = new QgsMessageBarItem(
438 tr( "Security warning" ),
439 tr( "Python macros cannot currently be run." ),
440 btnEnableMacros,
442 0,
443 messageBar
444 );
445
446 connect( btnEnableMacros, &QToolButton::clicked, messageBar, [=]() {
447 lambda();
448 messageBar->popWidget( macroMsg );
449 } );
450
451 // display the macros notification widget
452 messageBar->pushItem( macroMsg );
453 }
454
455 return false;
456 }
457 }
458 else if ( embeddedType == Qgis::PythonEmbeddedType::ExpressionFunction )
459 {
460 // create the notification widget for expressions from project
461 Q_ASSERT( messageBar );
462 if ( messageBar )
463 {
464 QToolButton *btnEnableExpressionsFromProject = new QToolButton();
465 btnEnableExpressionsFromProject->setText( tr( "Enable python expressions from project" ) );
466 btnEnableExpressionsFromProject->setStyleSheet( QStringLiteral( "background-color: rgba(255, 255, 255, 0); color: black; text-decoration: underline;" ) );
467 btnEnableExpressionsFromProject->setCursor( Qt::PointingHandCursor );
468 btnEnableExpressionsFromProject->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
469
470 QgsMessageBarItem *expressionFromProjectMsg = new QgsMessageBarItem(
471 tr( "Security warning" ),
472 tr( "Python expressions from project cannot currently be loaded." ),
473 btnEnableExpressionsFromProject,
475 0,
476 messageBar
477 );
478
479 connect( btnEnableExpressionsFromProject, &QToolButton::clicked, messageBar, [=]() {
481 messageBar->popWidget( expressionFromProjectMsg );
482 } );
483
484 // display the notification widget
485 messageBar->pushItem( expressionFromProjectMsg );
486 }
487
488 return false;
489 }
490 }
491 return false;
492}
493
495{
496 static std::once_flag initialized;
497 std::call_once( initialized, [=]() {
498 auto _initCalloutWidgetFunction = []( const QString &name, QgsCalloutWidgetFunc f ) {
500
501 QgsCalloutAbstractMetadata *abstractMetadata = registry->calloutMetadata( name );
502 if ( !abstractMetadata )
503 {
504 QgsDebugError( QStringLiteral( "Failed to find callout entry in registry: %1" ).arg( name ) );
505 }
506 QgsCalloutMetadata *metadata = dynamic_cast<QgsCalloutMetadata *>( abstractMetadata );
507 if ( !metadata )
508 {
509 QgsDebugError( QStringLiteral( "Failed to cast callout's metadata: " ).arg( name ) );
510 }
511 else
512 {
513 metadata->setWidgetFunction( f );
514 }
515 };
516
517 _initCalloutWidgetFunction( QStringLiteral( "simple" ), QgsSimpleLineCalloutWidget::create );
518 _initCalloutWidgetFunction( QStringLiteral( "manhattan" ), QgsManhattanLineCalloutWidget::create );
519 _initCalloutWidgetFunction( QStringLiteral( "curved" ), QgsCurvedLineCalloutWidget::create );
520 _initCalloutWidgetFunction( QStringLiteral( "balloon" ), QgsBalloonCalloutWidget::create );
521 } );
522}
523
525{
526#ifdef HAVE_WEBENGINE
527 return true;
528#else
529 return false;
530#endif
531}
532
534void QgsGui::emitOptionsChanged()
535{
536 emit optionsChanged();
537}
@ Warning
Warning message.
Definition qgis.h:156
PythonEmbeddedMode
Authorisation to run Python Embedded in projects.
Definition qgis.h:403
@ Always
Python embedded is always run.
@ NotForThisSession
Python embedded will not be run for this session.
@ Never
Python embedded never run.
@ Ask
User is prompt before running.
@ SessionOnly
Only during this session.
PythonEmbeddedType
Type of Python Embedded in projects.
Definition qgis.h:417
Registry of available advanced digitizing tools.
void addDefaultTools()
Adds the default tools shipped in QGIS.
Registry of available annotation item GUI behavior.
void addDefaultItems()
Populates the registry with default items.
static QString pluginPath()
Returns the path to the application plugin directory.
static const QgsSettingsEntryString * settingsLocaleUserLocale
Settings entry locale user locale.
static QgsCalloutRegistry * calloutRegistry()
Returns the application's callout registry, used for managing callout types.
static QString iconsPath()
Returns the path to the icons image directory.
Stores metadata about one callout renderer class.
Convenience metadata class that uses static functions to create callouts and their widgets.
void setWidgetFunction(QgsCalloutWidgetFunc f)
Registry of available callout classes.
QgsCalloutAbstractMetadata * calloutMetadata(const QString &type) const
Returns the metadata for specified the specified callout type.
A registry of color schemes for use in QgsCodeEditor widgets.
This class keeps a list of data item GUI providers that may affect how QgsDataItems behave within the...
void initializeFromProviderGuiRegistry(QgsProviderGuiRegistry *providerGuiRegistry)
Initializes the registry.
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:64
static QgsMapToolShapeRegistry * mapToolShapeRegistry()
Returns the registry of shape map tools.
Definition qgsgui.cpp:105
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories.
Definition qgsgui.cpp:95
static QgsProviderSourceWidgetProviderRegistry * sourceWidgetProviderRegistry()
Returns the registry of provider source widget providers.
Definition qgsgui.cpp:120
static QgsProcessingGuiRegistry * processingGuiRegistry()
Returns the global processing gui registry, used for registering the GUI behavior of processing algor...
Definition qgsgui.cpp:155
static QgsShortcutsManager * shortcutsManager()
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.
Definition qgsgui.cpp:125
static void setWindowManager(QgsWindowManagerInterface *manager)
Sets the global window manager.
Definition qgsgui.cpp:229
void optionsChanged()
This signal is emitted whenever the application options have been changed.
static QgsInputControllerManager * inputControllerManager()
Returns the global input controller manager.
Definition qgsgui.cpp:224
static QgsProcessingFavoriteAlgorithmManager * processingFavoriteAlgorithmManager()
Returns the global Processing favorite algorithm manager, used for tracking favorite Processing algor...
Definition qgsgui.cpp:170
static QgsLayerTreeEmbeddedWidgetRegistry * layerTreeEmbeddedWidgetRegistry()
Returns the global layer tree embedded widget registry, used for registering widgets that may be embe...
Definition qgsgui.cpp:130
static QScreen * findScreenAt(QPoint point)
Returns the screen at the given global point (pixel).
Definition qgsgui.cpp:292
static QgsAnnotationItemGuiRegistry * annotationItemGuiRegistry()
Returns the global annotation item GUI registry, used for registering the GUI behavior of annotation ...
Definition qgsgui.cpp:145
static QgsMapLayerActionRegistry * mapLayerActionRegistry()
Returns the global map layer action registry, used for registering map layer actions.
Definition qgsgui.cpp:135
static QgsGui * instance()
Returns a pointer to the singleton instance.
Definition qgsgui.cpp:79
static QgsProviderGuiRegistry * providerGuiRegistry()
Returns the registry of GUI-related components of data providers.
Definition qgsgui.cpp:190
static QgsRelationWidgetRegistry * relationWidgetRegistry()
Returns the global relation widget registry, used for managing all known relation widget factories.
Definition qgsgui.cpp:100
static QgsSensorGuiRegistry * sensorGuiRegistry()
Returns the registry of GUI-related components for sensors.
Definition qgsgui.cpp:195
static QgsAdvancedDigitizingToolsRegistry * advancedDigitizingToolsRegistry()
Returns the global advanced digitizing tools registry, used for registering advanced digitizing tools...
Definition qgsgui.cpp:150
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...
Definition qgsgui.cpp:210
static QgsHistoryProviderRegistry * historyProviderRegistry()
Returns the global history provider registry, used for tracking history providers.
Definition qgsgui.cpp:200
@ HigMenuTextIsTitleCase
Menu action texts should be title case.
Definition qgsgui.h:269
@ HigDialogTitleIsTitleCase
Dialog titles should be title case.
Definition qgsgui.h:270
static bool pythonEmbeddedInProjectAllowed(void(*lambda)()=nullptr, QgsMessageBar *messageBar=nullptr, Qgis::PythonEmbeddedType embeddedType=Qgis::PythonEmbeddedType::Macro)
Returns true if python embedded in a project is currently allowed to be loaded.
Definition qgsgui.cpp:376
static QgsNative * nativePlatformInterface()
Returns the global native interface, which offers abstraction to the host OS's underlying public inte...
Definition qgsgui.cpp:85
static bool hasWebEngine()
Checks whether QWebEngineView is available to display HTML content.
Definition qgsgui.cpp:524
static QgsWindowManagerInterface * windowManager()
Returns the global window manager, if set.
Definition qgsgui.cpp:219
static QgsDataItemGuiProviderRegistry * dataItemGuiProviderRegistry()
Returns the global data item GUI provider registry, used for tracking providers which affect the brow...
Definition qgsgui.cpp:180
static QgsProcessingRecentAlgorithmLog * processingRecentAlgorithmLog()
Returns the global processing recent algorithm log, used for tracking recently used processing algori...
Definition qgsgui.cpp:175
QFlags< HigFlag > HigFlags
Definition qgsgui.h:272
static QgsSubsetStringEditorProviderRegistry * subsetStringEditorProviderRegistry()
Returns the registry of subset string editors of data providers.
Definition qgsgui.cpp:115
static QgsProjectStorageGuiRegistry * projectStorageGuiRegistry()
Returns the global GUI-related project storage registry.
Definition qgsgui.cpp:185
static QgsGui::HigFlags higFlags()
Returns the platform's HIG flags.
Definition qgsgui.cpp:234
static QgsLayoutItemGuiRegistry * layoutItemGuiRegistry()
Returns the global layout item GUI registry, used for registering the GUI behavior of layout items.
Definition qgsgui.cpp:140
static void initCalloutWidgets()
Initializes callout widgets.
Definition qgsgui.cpp:494
static QgsSettingsRegistryGui * settingsRegistryGui()
Returns the gui's settings registry, used for managing gui settings.
Definition qgsgui.cpp:90
static QgsSourceSelectProviderRegistry * sourceSelectProviderRegistry()
Returns the global source select provider registry, used for managing all known source select widget ...
Definition qgsgui.cpp:110
static QgsCodeEditorColorSchemeRegistry * codeEditorColorSchemeRegistry()
Returns the global code editor color scheme registry, used for registering the color schemes for QgsC...
Definition qgsgui.cpp:165
static QgsNumericFormatGuiRegistry * numericFormatGuiRegistry()
Returns the global numeric format gui registry, used for registering the GUI widgets associated with ...
Definition qgsgui.cpp:160
static QgsSettingsEditorWidgetRegistry * settingsEditorWidgetRegistry()
Returns the registry of settings editors.
Definition qgsgui.cpp:205
static QColor sampleColor(QPoint point)
Samples the color on screen at the specified global point (pixel).
Definition qgsgui.cpp:277
~QgsGui()
Definition qgsgui.cpp:246
The QgsHistoryProviderRegistry is a registry for objects which track user history (i....
void addDefaultProviders()
Adds the default history providers to the registry.
Manages input control devices.
Source select provider for layer metadata.
Registry of widgets that may be embedded into layer tree view.
Registry of available layout item GUI behavior.
This class tracks map layer actions.
Keeps track of the registered shape map tools.
Represents an item shown within a QgsMessageBar widget.
A bar for displaying non-blocking messages to the user.
bool popWidget(QgsMessageBarItem *item)
Remove the specified item from the bar, and display the next most recent one in the stack.
void pushMessage(const QString &text, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=-1)
A convenience method for pushing a message with the specified text to the bar.
void pushItem(QgsMessageBarItem *item)
Display a message item on the bar, after hiding the currently visible one and putting it in a stack.
The QgsNumericFormatGuiRegistry is a home for widgets for configuring QgsNumericFormat objects.
The QgsProcessingGuiRegistry is a home for widgets for processing configuration widgets.
A registry / canonical manager of GUI parts of project storage backends.
void initializeFromProviderGuiRegistry(QgsProviderGuiRegistry *providerGuiRegistry)
Initializes the registry.
static QgsProject * instance()
Returns the QgsProject singleton instance.
bool loadFunctionsFromProject(bool force=false)
Loads python expression functions stored in the currrent project.
A registry / canonical manager of GUI parts of data providers.
This class keeps a list of provider source widget providers.
void initializeFromProviderGuiRegistry(QgsProviderGuiRegistry *providerGuiRegistry)
Initializes the registry.
Keeps track of the registered relations widgets.
Registry of available sensor GUI behavior.
bool populate()
Populates the registry with standard sensor types.
This class manages editor widgets for settings.
QgsSettingsRegistryGui is used for settings introspection and collects all QgsSettingsEntry instances...
This class is a composition of two QSettings instances:
Definition qgssettings.h:64
void setEnumValue(const QString &key, const T &value, const Section section=NoSection)
Set the value of a setting based on an enum.
T enumValue(const QString &key, const T &defaultValue, const Section section=NoSection)
Returns the setting value for a setting based on an enum.
Shortcuts manager is a class that contains a list of QActions and QShortcuts that have been registere...
This class keeps a list of source select providers that may add items to the QgsDataSourceManagerDial...
void initializeFromProviderGuiRegistry(QgsProviderGuiRegistry *providerGuiRegistry)
Initializes the registry.
void addProvider(QgsSourceSelectProvider *provider)
Add a provider implementation. Takes ownership of the object.
This class keeps a list of subset string editor providers.
void initializeFromProviderGuiRegistry(QgsProviderGuiRegistry *providerGuiRegistry)
Initializes the registry.
QgsWidgetStateHelper is a helper class to save and restore the geometry of QWidgets in the applicatio...
void registerWidget(QWidget *widget, const QString &key=QString())
Register a widget to have it geometry state automatically saved and restored.
QgsCalloutWidget *(* QgsCalloutWidgetFunc)(QgsMapLayer *)
#define QgsDebugError(str)
Definition qgslogger.h:38