QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
Public Types | Public Slots | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
QgsLayerPropertiesDialog Class Referenceabstract

Base class for "layer properties" dialogs, containing common utilities for handling functionality in these dialog. More...

#include <qgslayerpropertiesdialog.h>

Inheritance diagram for QgsLayerPropertiesDialog:
Inheritance graph
[legend]

Public Types

enum  StyleType { QML , SLD , DatasourceDatabase , UserDatabase }
 Style storage type. More...
 

Public Slots

void loadDefaultMetadata ()
 Reloads the default layer metadata for the layer.
 
void loadDefaultStyle ()
 Reloads the default style for the layer.
 
void loadMetadataFromFile ()
 Allows the user to load layer metadata from a file.
 
void loadStyleFromFile ()
 Allows the user to load layer style from a file.
 
void saveMetadataAsDefault ()
 Saves the current layer metadata as the default for the layer.
 
void saveMetadataToFile ()
 Allows the user to save the layer's metadata as a file.
 
void saveStyleAsDefault ()
 Saves the current layer style as the default for the layer.
 
void saveStyleToFile ()
 Allows the user to save the layer's style to a file.
 
- Public Slots inherited from QgsOptionsDialogBase
void searchText (const QString &text)
 searchText searches for a text in all the pages of the stacked widget and highlight the results
 

Public Member Functions

 QgsLayerPropertiesDialog (QgsMapLayer *layer, QgsMapCanvas *canvas, const QString &settingsKey, QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::WindowFlags(), QgsSettings *settings=nullptr)
 Constructor for QgsLayerPropertiesDialog.
 
virtual void addPropertiesPageFactory (const QgsMapLayerConfigWidgetFactory *factory)
 Adds properties page from a factory.
 
void loadStyle ()
 Triggers a dialog to load a saved style.
 
void saveDefaultStyle ()
 Saves the default style when appropriate button is pressed.
 
void saveStyleAs ()
 Saves a style when appriate button is pressed.
 
void setMetadataWidget (QgsMetadataWidget *widget, QWidget *page)
 Sets the metadata widget and page associated with the dialog.
 
- Public Member Functions inherited from QgsOptionsDialogBase
 QgsOptionsDialogBase (const QString &settingsKey, QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::WindowFlags(), QgsSettings *settings=nullptr)
 Constructor.
 
 ~QgsOptionsDialogBase () override
 
void addPage (const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QStringList &path=QStringList(), const QString &key=QString())
 Adds a new page to the dialog pages.
 
bool iconOnly ()
 Determine if the options list is in icon only mode.
 
void initOptionsBase (bool restoreUi=true, const QString &title=QString())
 Set up the base ui connections for vertical tabs.
 
void insertPage (const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QString &before, const QStringList &path=QStringList(), const QString &key=QString())
 Inserts a new page into the dialog pages.
 
void resizeAlltabs (int index)
 Resizes all tabs when the dialog is resized.
 
void restoreLastPage ()
 Refocus the active tab from the last time the dialog was shown.
 
void restoreOptionsBaseUi (const QString &title=QString())
 Restore the base ui.
 
void setCurrentPage (const QString &page)
 Sets the dialog page (by object name) to show.
 
void setSettings (QgsSettings *settings)
 

Protected Slots

virtual void apply ()=0
 Applies the dialog settings to the layer.
 
void openUrl (const QUrl &url)
 Handles opening a url from the dialog.
 
void optionsStackedWidget_CurrentChanged (int index) override
 
virtual void rollback ()
 Rolls back changes made to the layer.
 
virtual void syncToLayer ()=0
 Resets the dialog to the current layer state.
 
- Protected Slots inherited from QgsOptionsDialogBase
virtual void optionsStackedWidget_CurrentChanged (int index)
 Select relevant tab on current page change.
 
virtual void optionsStackedWidget_WidgetRemoved (int index)
 Remove tab and unregister widgets on page remove.
 
virtual void updateOptionsListVerticalTabs ()
 Update tabs on the splitter move.
 
void warnAboutMissingObjects ()
 

Protected Member Functions

void initialize ()
 Initialize the dialog.
 
void refocusDialog ()
 Ensures the dialog is focused and activated.
 
void storeCurrentStyleForUndo ()
 Stores the current layer style so that undo operations can be performed.
 
- Protected Member Functions inherited from QgsOptionsDialogBase
QStandardItem * createItem (const QString &name, const QString &tooltip, const QString &icon)
 Creates a new QStandardItem with the specified name, tooltip and icon.
 
void paintEvent (QPaintEvent *e) override
 
void registerTextSearchWidgets ()
 register widgets in the dialog to search for text in it it is automatically called if a line edit has "mSearchLineEdit" as object name.
 
void showEvent (QShowEvent *e) override
 
virtual void updateWindowTitle ()
 

Protected Attributes

QPushButton * mBtnMetadata = nullptr
 Metadata button.
 
QPushButton * mBtnStyle = nullptr
 Style button.
 
QgsMapCanvasmCanvas = nullptr
 Associated map canvas.
 
QList< QgsMapLayerConfigWidget * > mConfigWidgets
 Layer config widgets.
 
QgsMapLayerStyle mOldStyle
 Previous layer style.
 
- Protected Attributes inherited from QgsOptionsDialogBase
bool mDelSettings = false
 
QString mDialogTitle
 
bool mIconOnly = false
 
bool mInit = false
 
QDialogButtonBox * mOptButtonBox = nullptr
 
QListWidget * mOptListWidget = nullptr
 
QString mOptsKey
 
QSplitter * mOptSplitter = nullptr
 
QStackedWidget * mOptStackedWidget = nullptr
 
QStandardItemModel * mOptTreeModel = nullptr
 
QTreeView * mOptTreeView = nullptr
 
QList< QPair< QgsOptionsDialogHighlightWidget *, int > > mRegisteredSearchWidgets
 
QgsFilterLineEditmSearchLineEdit = nullptr
 
QPointer< QgsSettingsmSettings
 
QgsOptionsProxyModel * mTreeProxyModel = nullptr
 

Detailed Description

Base class for "layer properties" dialogs, containing common utilities for handling functionality in these dialog.

Warning
This is exposed to SIP bindings for legacy reasons only, and is NOT to be considered as stable API.
Since
QGIS 3.34

Definition at line 39 of file qgslayerpropertiesdialog.h.

Member Enumeration Documentation

◆ StyleType

Style storage type.

Enumerator
QML 
SLD 
DatasourceDatabase 
UserDatabase 

Definition at line 50 of file qgslayerpropertiesdialog.h.

Constructor & Destructor Documentation

◆ QgsLayerPropertiesDialog()

QgsLayerPropertiesDialog::QgsLayerPropertiesDialog ( QgsMapLayer layer,
QgsMapCanvas canvas,
const QString &  settingsKey,
QWidget *  parent = nullptr,
Qt::WindowFlags  fl = Qt::WindowFlags(),
QgsSettings settings = nullptr 
)

Constructor for QgsLayerPropertiesDialog.

Parameters
layerassociated map layer
canvasassociated map canvas
settingsKeyQgsSettings subgroup key for saving/restore ui states, e.g. "VectorLayerProperties".
parentparent object (owner)
flwidget flags
settingscustom QgsSettings pointer

Definition at line 37 of file qgslayerpropertiesdialog.cpp.

Member Function Documentation

◆ addPropertiesPageFactory()

void QgsLayerPropertiesDialog::addPropertiesPageFactory ( const QgsMapLayerConfigWidgetFactory factory)
virtual

Adds properties page from a factory.

Reimplemented in QgsRasterLayerProperties.

Definition at line 267 of file qgslayerpropertiesdialog.cpp.

◆ apply

virtual void QgsLayerPropertiesDialog::apply ( )
protectedpure virtualslot

Applies the dialog settings to the layer.

◆ initialize()

void QgsLayerPropertiesDialog::initialize ( )
protected

Initialize the dialog.

Must be called in the subclass constructor as the final call.

Definition at line 257 of file qgslayerpropertiesdialog.cpp.

◆ loadDefaultMetadata

void QgsLayerPropertiesDialog::loadDefaultMetadata ( )
slot

Reloads the default layer metadata for the layer.

See also
saveMetadataAsDefault()

Definition at line 136 of file qgslayerpropertiesdialog.cpp.

◆ loadDefaultStyle

void QgsLayerPropertiesDialog::loadDefaultStyle ( )
slot

Reloads the default style for the layer.

Definition at line 286 of file qgslayerpropertiesdialog.cpp.

◆ loadMetadataFromFile

void QgsLayerPropertiesDialog::loadMetadataFromFile ( )
slot

Allows the user to load layer metadata from a file.

See also
saveMetadataToFile()

Definition at line 50 of file qgslayerpropertiesdialog.cpp.

◆ loadStyle()

void QgsLayerPropertiesDialog::loadStyle ( )

Triggers a dialog to load a saved style.

Since
QGIS 3.30

Definition at line 493 of file qgslayerpropertiesdialog.cpp.

◆ loadStyleFromFile

void QgsLayerPropertiesDialog::loadStyleFromFile ( )
slot

Allows the user to load layer style from a file.

See also
saveStyleToFile()

Definition at line 155 of file qgslayerpropertiesdialog.cpp.

◆ openUrl

void QgsLayerPropertiesDialog::openUrl ( const QUrl &  url)
protectedslot

Handles opening a url from the dialog.

If the url refers to a local file then a file explorer will be opened pointing to the file. If it refers to a remote link then a web browser will be opened instead.

Definition at line 627 of file qgslayerpropertiesdialog.cpp.

◆ optionsStackedWidget_CurrentChanged

void QgsLayerPropertiesDialog::optionsStackedWidget_CurrentChanged ( int  index)
overrideprotectedslot

Definition at line 615 of file qgslayerpropertiesdialog.cpp.

◆ refocusDialog()

void QgsLayerPropertiesDialog::refocusDialog ( )
protected

Ensures the dialog is focused and activated.

Definition at line 262 of file qgslayerpropertiesdialog.cpp.

◆ rollback

void QgsLayerPropertiesDialog::rollback ( )
protectedvirtualslot

Rolls back changes made to the layer.

Definition at line 601 of file qgslayerpropertiesdialog.cpp.

◆ saveDefaultStyle()

void QgsLayerPropertiesDialog::saveDefaultStyle ( )

Saves the default style when appropriate button is pressed.

Since
QGIS 3.30

Definition at line 347 of file qgslayerpropertiesdialog.cpp.

◆ saveMetadataAsDefault

void QgsLayerPropertiesDialog::saveMetadataAsDefault ( )
slot

Saves the current layer metadata as the default for the layer.

loadDefaultMetadata()

Definition at line 120 of file qgslayerpropertiesdialog.cpp.

◆ saveMetadataToFile

void QgsLayerPropertiesDialog::saveMetadataToFile ( )
slot

Allows the user to save the layer's metadata as a file.

See also
loadMetadataFromFile()

Definition at line 84 of file qgslayerpropertiesdialog.cpp.

◆ saveStyleAs()

void QgsLayerPropertiesDialog::saveStyleAs ( )

Saves a style when appriate button is pressed.

Since
QGIS 3.30

Definition at line 401 of file qgslayerpropertiesdialog.cpp.

◆ saveStyleAsDefault

void QgsLayerPropertiesDialog::saveStyleAsDefault ( )
slot

Saves the current layer style as the default for the layer.

loadDefaultStyle()

Definition at line 230 of file qgslayerpropertiesdialog.cpp.

◆ saveStyleToFile

void QgsLayerPropertiesDialog::saveStyleToFile ( )
slot

Allows the user to save the layer's style to a file.

See also
loadStyleFromFile()

Definition at line 191 of file qgslayerpropertiesdialog.cpp.

◆ setMetadataWidget()

void QgsLayerPropertiesDialog::setMetadataWidget ( QgsMetadataWidget widget,
QWidget *  page 
)

Sets the metadata widget and page associated with the dialog.

This must be called in order for the standard metadata loading/saving functionality to be available.

Definition at line 44 of file qgslayerpropertiesdialog.cpp.

◆ storeCurrentStyleForUndo()

void QgsLayerPropertiesDialog::storeCurrentStyleForUndo ( )
protected

Stores the current layer style so that undo operations can be performed.

Definition at line 583 of file qgslayerpropertiesdialog.cpp.

◆ syncToLayer

virtual void QgsLayerPropertiesDialog::syncToLayer ( )
protectedpure virtualslot

Resets the dialog to the current layer state.

Member Data Documentation

◆ mBtnMetadata

QPushButton* QgsLayerPropertiesDialog::mBtnMetadata = nullptr
protected

Metadata button.

Definition at line 189 of file qgslayerpropertiesdialog.h.

◆ mBtnStyle

QPushButton* QgsLayerPropertiesDialog::mBtnStyle = nullptr
protected

Style button.

Definition at line 186 of file qgslayerpropertiesdialog.h.

◆ mCanvas

QgsMapCanvas* QgsLayerPropertiesDialog::mCanvas = nullptr
protected

Associated map canvas.

Definition at line 192 of file qgslayerpropertiesdialog.h.

◆ mConfigWidgets

QList<QgsMapLayerConfigWidget *> QgsLayerPropertiesDialog::mConfigWidgets
protected

Layer config widgets.

Definition at line 195 of file qgslayerpropertiesdialog.h.

◆ mOldStyle

QgsMapLayerStyle QgsLayerPropertiesDialog::mOldStyle
protected

Previous layer style.

Used to reset style to previous state if new style was loaded but dialog is canceled.

Definition at line 183 of file qgslayerpropertiesdialog.h.


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