30#include "qgsmacnative.h" 
   31#elif defined (Q_OS_WIN) 
   33#include "qgswinnative.h" 
   37#elif defined (Q_OS_LINUX) 
   38#include "qgslinuxnative.h" 
   80  return instance()->mSettingsRegistryGui;
 
   85  return instance()->mEditorWidgetRegistry;
 
   90  return instance()->mRelationEditorRegistry;
 
   95  return instance()->mShapeMapToolRegistry;
 
  100  return instance()->mSourceSelectProviderRegistry;
 
  105  return instance()->mSubsetStringEditorProviderRegistry;
 
  110  return instance()->mProviderSourceWidgetProviderRegistry;
 
  115  return instance()->mShortcutsManager;
 
  120  return instance()->mLayerTreeEmbeddedWidgetRegistry;
 
  125  return instance()->mMapLayerActionRegistry;
 
  130  return instance()->mLayoutItemGuiRegistry;
 
  135  return instance()->mAnnotationItemGuiRegistry;
 
  140  return instance()->mProcessingGuiRegistry;
 
  145  return instance()->mNumericFormatGuiRegistry;
 
  150  return instance()->mCodeEditorColorSchemeRegistry;
 
  155  return instance()->mProcessingRecentAlgorithmLog;
 
  160  return instance()->mDataItemGuiProviderRegistry;
 
  165  return instance()->mProjectStorageGuiRegistry;
 
  170  return instance()->mProviderGuiRegistry;
 
  175  return instance()->mHistoryProviderRegistry;
 
  180  if ( widget->objectName().isEmpty() )
 
  182    QgsDebugMsg( QStringLiteral( 
"WARNING: No object name set. Best for it to be set objectName when using QgsGui::enableAutoGeometryRestore" ) );
 
  189  return instance()->mWindowManager.get();
 
  194  instance()->mWindowManager.reset( manager );
 
  205    return QgsGui::HigFlags();
 
  211  delete mProcessingGuiRegistry;
 
  212  delete mDataItemGuiProviderRegistry;
 
  213  delete mProcessingRecentAlgorithmLog;
 
  214  delete mLayoutItemGuiRegistry;
 
  215  delete mAnnotationItemGuiRegistry;
 
  216  delete mLayerTreeEmbeddedWidgetRegistry;
 
  217  delete mEditorWidgetRegistry;
 
  218  delete mMapLayerActionRegistry;
 
  219  delete mSourceSelectProviderRegistry;
 
  220  delete mHistoryProviderRegistry;
 
  221  delete mShortcutsManager;
 
  223  delete mNumericFormatGuiRegistry;
 
  224  delete mWidgetStateHelper;
 
  225  delete mProjectStorageGuiRegistry;
 
  226  delete mProviderGuiRegistry;
 
  227  delete mCodeEditorColorSchemeRegistry;
 
  228  delete mSubsetStringEditorProviderRegistry;
 
  229  delete mProviderSourceWidgetProviderRegistry;
 
  230  delete mShapeMapToolRegistry;
 
  231  delete mRelationEditorRegistry;
 
  232  delete mSettingsRegistryGui;
 
  243  const int x = point.x() - screen->geometry().left();
 
  244  const int y = point.y() - screen->geometry().top();
 
  245  const QPixmap snappedPixmap = screen->grabWindow( 0, x, y, 1, 1 );
 
  246  const QImage snappedImage = snappedPixmap.toImage();
 
  247  return snappedImage.pixel( 0, 0 );
 
  252  const QList< QScreen * > screens = QGuiApplication::screens();
 
  253  for ( QScreen *screen : screens )
 
  255    if ( screen->geometry().contains( point ) )
 
  266  QgsMacNative *macNative = 
new QgsMacNative();
 
  269#elif defined (Q_OS_WIN) 
  271  mNative = 
new QgsWinNative();
 
  273  mNative = 
new QgsNative();
 
  275#elif defined(Q_OS_LINUX) 
  276  mNative = 
new QgsLinuxNative();
 
  278  mNative = 
new QgsNative();
 
  316  mProcessingRecentAlgorithmLog = 
new QgsProcessingRecentAlgorithmLog();
 
  336                                 tr( 
"Python macros are currently disabled and will not be run" ),
 
  337                                 Qgis::MessageLevel::Warning );
 
  343        QMessageBox msgBox( QMessageBox::Information, tr( 
"Python Macros" ),
 
  344                            tr( 
"Python macros are currently disabled. Do you allow this macro to run?" ) );
 
  345        QAbstractButton *stopSessionButton = msgBox.addButton( tr( 
"Disable for this Session" ), QMessageBox::DestructiveRole );
 
  346        msgBox.addButton( tr( 
"No" ), QMessageBox::NoRole );
 
  347        QAbstractButton *yesButton = msgBox.addButton( tr( 
"Yes" ), QMessageBox::YesRole );
 
  350        QAbstractButton *clicked = msgBox.clickedButton();
 
  351        if ( clicked == stopSessionButton )
 
  355        return clicked == yesButton;
 
  360        Q_ASSERT( messageBar );
 
  363          QToolButton *btnEnableMacros = 
new QToolButton();
 
  364          btnEnableMacros->setText( tr( 
"Enable Macros" ) );
 
  365          btnEnableMacros->setStyleSheet( QStringLiteral( 
"background-color: rgba(255, 255, 255, 0); color: black; text-decoration: underline;" ) );
 
  366          btnEnableMacros->setCursor( Qt::PointingHandCursor );
 
  367          btnEnableMacros->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
 
  370            tr( 
"Security warning" ),
 
  371            tr( 
"Python macros cannot currently be run." ),
 
  373            Qgis::MessageLevel::Warning,
 
  377          connect( btnEnableMacros, &QToolButton::clicked, messageBar, [ = ]()
 
  394void QgsGui::emitOptionsChanged()
 
PythonMacroMode
Vector layer type flags.
@ Always
Macros are always run.
@ NotForThisSession
Macros will not be run for this session.
@ Never
Macros are never run.
@ Ask
User is prompt before running.
@ SessionOnly
Only during this session.
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 QString iconsPath()
Returns the path to the icons image directory.
static const QgsSettingsEntryString settingsLocaleUserLocale
Settings entry locale user locale.
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.
QgsGui is a singleton class containing various registry and other global members related to GUI class...
static QgsMapToolShapeRegistry * mapToolShapeRegistry()
Returns the registry of shape map tools.
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories.
static QgsProviderSourceWidgetProviderRegistry * sourceWidgetProviderRegistry()
Returns the registry of provider source widget providers.
static QgsProcessingGuiRegistry * processingGuiRegistry()
Returns the global processing gui registry, used for registering the GUI behavior of processing algor...
static QgsShortcutsManager * shortcutsManager()
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.
static void setWindowManager(QgsWindowManagerInterface *manager)
Sets the global window manager.
void optionsChanged()
This signal is emitted whenever the application options have been changed.
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,...
static QgsLayerTreeEmbeddedWidgetRegistry * layerTreeEmbeddedWidgetRegistry()
Returns the global layer tree embedded widget registry, used for registering widgets that may be embe...
static QScreen * findScreenAt(QPoint point)
Returns the screen at the given global point (pixel).
static QgsAnnotationItemGuiRegistry * annotationItemGuiRegistry()
Returns the global annotation item GUI registry, used for registering the GUI behavior of annotation ...
static QgsMapLayerActionRegistry * mapLayerActionRegistry()
Returns the global map layer action registry, used for registering map layer actions.
static QgsGui * instance()
Returns a pointer to the singleton instance.
static QgsProviderGuiRegistry * providerGuiRegistry()
Returns the registry of GUI-related components of data providers.
static QgsRelationWidgetRegistry * relationWidgetRegistry()
Returns the global relation widget registry, used for managing all known relation widget factories.
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...
static QgsHistoryProviderRegistry * historyProviderRegistry()
Returns the global history provider registry, used for tracking history providers.
@ HigMenuTextIsTitleCase
Menu action texts should be title case.
@ HigDialogTitleIsTitleCase
Dialog titles should be title case.
static QgsNative * nativePlatformInterface()
Returns the global native interface, which offers abstraction to the host OS's underlying public inte...
static QgsWindowManagerInterface * windowManager()
Returns the global window manager, if set.
static QgsDataItemGuiProviderRegistry * dataItemGuiProviderRegistry()
Returns the global data item GUI provider registry, used for tracking providers which affect the brow...
static QgsProcessingRecentAlgorithmLog * processingRecentAlgorithmLog()
Returns the global processing recent algorithm log, used for tracking recently used processing algori...
static QgsSubsetStringEditorProviderRegistry * subsetStringEditorProviderRegistry()
Returns the registry of subset string editors of data providers.
static QgsProjectStorageGuiRegistry * projectStorageGuiRegistry()
Returns the global GUI-related project storage registry.
static QgsGui::HigFlags higFlags()
Returns the platform's HIG flags.
static QgsLayoutItemGuiRegistry * layoutItemGuiRegistry()
Returns the global layout item GUI registry, used for registering the GUI behavior of layout items.
static QgsSettingsRegistryGui * settingsRegistryGui()
Returns the gui's settings registry, used for managing gui settings.
static QgsSourceSelectProviderRegistry * sourceSelectProviderRegistry()
Returns the global source select provider registry, used for managing all known source select widget ...
static QgsCodeEditorColorSchemeRegistry * codeEditorColorSchemeRegistry()
Returns the global code editor color scheme registry, used for registering the color schemes for QgsC...
static QgsNumericFormatGuiRegistry * numericFormatGuiRegistry()
Returns the global numeric format gui registry, used for registering the GUI widgets associated with ...
static QColor sampleColor(QPoint point)
Samples the color on screen at the specified global point (pixel).
The QgsHistoryProviderRegistry is a registry for objects which track user history (i....
void addDefaultProviders()
Adds the default history providers to the registry.
Registry of available layout item GUI behavior.
This class tracks map layer actions.
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 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.
A registry / canonical manager of GUI parts of data providers.
QgsSettingsRegistryGui is used for settings introspection and collects all QgsSettingsEntry instances...
This class is a composition of two QSettings instances:
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.