QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgsmaplayerconfigwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaplayerconfigwidget.h
3  -------------------------
4  begin : June 2016
5  copyright : (C) 2016 by Nathan Woodrow
6  email : woodrow dot nathan at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSMAPLAYERCONFIGWIDGET_H
16 #define QGSMAPLAYERCONFIGWIDGET_H
17 
18 #include <QWidget>
19 #include <QIcon>
20 #include <QPointer>
21 
22 #include "qgspanelwidget.h"
23 #include "qgslayertreegroup.h"
24 #include "qgis_gui.h"
25 
26 class QgsMapCanvas;
27 class QgsMapLayer;
28 class QgsMessageBar;
29 
37 {
38  public:
39 
46  QString annotationId() const { return mAnnotationId; }
47 
54  void setAnnotationId( const QString &id ) { mAnnotationId = id; }
55 
62  void setMapCanvas( QgsMapCanvas *canvas ) { mMapCanvas = canvas; }
63 
68  QgsMapCanvas *mapCanvas() const { return mMapCanvas; }
69 
75  void setMessageBar( QgsMessageBar *bar ) { mMessageBar = bar; }
76 
81  QgsMessageBar *messageBar() const { return mMessageBar; }
82 
89  void setLayerTreeGroup( QgsLayerTreeGroup *group );
90 
97  QgsLayerTreeGroup *layerTreeGroup() const;
98 
99  private:
100 
101  QString mAnnotationId;
102  QgsMapCanvas *mMapCanvas = nullptr;
103  QgsMessageBar *mMessageBar = nullptr;
104  QPointer< QgsLayerTreeGroup > mLayerTreeGroup = nullptr;
105 
106 };
107 
108 
115 class GUI_EXPORT QgsMapLayerConfigWidget : public QgsPanelWidget
116 {
117  Q_OBJECT
118  public:
119 
128  QgsMapLayerConfigWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
129 
136  virtual bool shouldTriggerLayerRepaint() const { return true; }
137 
142  virtual void syncToLayer( QgsMapLayer *layer ) { Q_UNUSED( layer ) }
143 
149  virtual void setMapLayerConfigWidgetContext( const QgsMapLayerConfigWidgetContext &context );
150 
151  public slots:
152 
157  virtual void apply() = 0;
158 
164  virtual void focusDefaultWidget();
165 
166  signals:
167 
168 #ifndef SIP_RUN
169 
177  void dynamicTemporalControlToggled( bool enabled );
178 #endif
179 
180  protected:
181 
182  QgsMapLayer *mLayer = nullptr;
183  QgsMapCanvas *mMapCanvas = nullptr;
185 };
186 
187 #endif // QGSMAPLAYERCONFIGWIDGET_H
Layer tree group node serves as a container for layers and further groups.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:90
Encapsulates the context for a QgsMapLayerConfigWidget.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
void setAnnotationId(const QString &id)
Sets the item id of the target annotation, when modifying an annotation from a QgsAnnotationLayer.
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
QString annotationId() const
Returns the item ID of the target annotation, when modifying an annotation from a QgsAnnotationLayer.
A panel widget that can be shown in the map style dock.
virtual void apply()=0
Called when changes to the layer need to be made.
void dynamicTemporalControlToggled(bool enabled)
Emitted whenever the dynamic temporal control option is toggled in the associated layer properties di...
virtual void syncToLayer(QgsMapLayer *layer)
Reset to original (vector layer) values.
QgsMapLayerConfigWidgetContext mMapLayerConfigWidgetContext
virtual bool shouldTriggerLayerRepaint() const
Whether this config widget changes map layer properties in a way that triggerRepaint() should be call...
Base class for all map layer types.
Definition: qgsmaplayer.h:73
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
Base class for any widget that can be shown as a inline panel.