Skip to content
Permalink
Browse files

Merge pull request #42681 from suricactus/layer_props_page

Open a specific page in the layer properties dialog using the iface instance
  • Loading branch information
m-kuhn committed Apr 8, 2021
2 parents b057ad5 + 2788303 commit 3cf8a982af34a8f112d44206fcfde0d8ff53d7f3
@@ -1138,9 +1138,42 @@ Removes the specified ``dock`` widget from main window (without deleting it).
.. seealso:: :py:func:`addDockWidget`
%End

virtual void showLayerProperties( QgsMapLayer *l ) = 0;
virtual void showLayerProperties( QgsMapLayer *l, const QString &page = QString() ) = 0;
%Docstring
Open layer properties dialog
Opens layer properties dialog for the layer ``l``.
Optionally, a ``page`` to open can be specified (since QGIS 3.20).
The list below contains valid page names:

Vector Layer:
mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_Labels,
mOptsPage_Masks, mOptsPage_Diagrams, mOptsPage_SourceFields, mOptsPage_AttributesForm,
mOptsPage_Joins, mOptsPage_AuxiliaryStorage, mOptsPage_Actions, mOptsPage_Display,
mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Variables, mOptsPage_Metadata,
mOptsPage_DataDependencies, mOptsPage_Legend, mOptsPage_Server

Raster Layer:
mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_Transparency,
mOptsPage_Histogram, mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Pyramids,
mOptsPage_Metadata, mOptsPage_Legend, mOptsPage_Server

Mesh Layer:
mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_StyleContent,
mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Metadata

Point Cloud Layer:
mOptsPage_Information, mOptsPage_Source, mOptsPage_Metadata, mOptsPage_Statistics

Vector Tile Layer:
mOptsPage_Information, mOptsPage_Style, mOptsPage_Labeling, mOptsPage_Metadata

.. note::

Page names are subject to change without notice between QGIS versions,
they are not considered part of the stable API.

.. note::

More strings may be available depending on the context, e.g. via plugins.
%End

virtual QDialog *showAttributeTable( QgsVectorLayer *l, const QString &filterExpression = QString() ) = 0;
@@ -497,11 +497,11 @@ QgsAdvancedDigitizingDockWidget *QgisAppInterface::cadDockWidget()
return qgis->cadDockWidget();
}

void QgisAppInterface::showLayerProperties( QgsMapLayer *l )
void QgisAppInterface::showLayerProperties( QgsMapLayer *l, const QString &page )
{
if ( l && qgis )
{
qgis->showLayerProperties( l );
qgis->showLayerProperties( l, page );
}
}

@@ -137,7 +137,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
void addTabifiedDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget, const QStringList &tabifyWith = QStringList(), bool raiseTab = false ) override;
void removeDockWidget( QDockWidget *dockwidget ) override;
QgsAdvancedDigitizingDockWidget *cadDockWidget() override;
void showLayerProperties( QgsMapLayer *l ) override;
void showLayerProperties( QgsMapLayer *l, const QString &page = QString() ) override;
QDialog *showAttributeTable( QgsVectorLayer *l, const QString &filterExpression = QString() ) override;
void addWindow( QAction *action ) override;
void removeWindow( QAction *action ) override;
@@ -971,8 +971,39 @@ class GUI_EXPORT QgisInterface : public QObject
*/
virtual void removeDockWidget( QDockWidget *dockwidget ) = 0;

//! Open layer properties dialog
virtual void showLayerProperties( QgsMapLayer *l ) = 0;
/**
* Opens layer properties dialog for the layer \a l.
* Optionally, a \a page to open can be specified (since QGIS 3.20).
* The list below contains valid page names:
*
* Vector Layer:
* mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_Labels,
* mOptsPage_Masks, mOptsPage_Diagrams, mOptsPage_SourceFields, mOptsPage_AttributesForm,
* mOptsPage_Joins, mOptsPage_AuxiliaryStorage, mOptsPage_Actions, mOptsPage_Display,
* mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Variables, mOptsPage_Metadata,
* mOptsPage_DataDependencies, mOptsPage_Legend, mOptsPage_Server
*
* Raster Layer:
* mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_Transparency,
* mOptsPage_Histogram, mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Pyramids,
* mOptsPage_Metadata, mOptsPage_Legend, mOptsPage_Server
*
* Mesh Layer:
* mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_StyleContent,
* mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Metadata
*
* Point Cloud Layer:
* mOptsPage_Information, mOptsPage_Source, mOptsPage_Metadata, mOptsPage_Statistics
*
* Vector Tile Layer:
* mOptsPage_Information, mOptsPage_Style, mOptsPage_Labeling, mOptsPage_Metadata
*
* \note Page names are subject to change without notice between QGIS versions,
* they are not considered part of the stable API.
*
* \note More strings may be available depending on the context, e.g. via plugins.
*/
virtual void showLayerProperties( QgsMapLayer *l, const QString &page = QString() ) = 0;

//! Open attribute table dialog
virtual QDialog *showAttributeTable( QgsVectorLayer *l, const QString &filterExpression = QString() ) = 0;

0 comments on commit 3cf8a98

Please sign in to comment.