QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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 
21 #include "qgspanelwidget.h"
22 #include "qgis_gui.h"
23 
24 class QgsMapCanvas;
25 class QgsMapLayer;
26 class QgsMessageBar;
27 
35 {
36  public:
37 
44  QString annotationId() const { return mAnnotationId; }
45 
52  void setAnnotationId( const QString &id ) { mAnnotationId = id; }
53 
60  void setMapCanvas( QgsMapCanvas *canvas ) { mMapCanvas = canvas; }
61 
66  QgsMapCanvas *mapCanvas() const { return mMapCanvas; }
67 
73  void setMessageBar( QgsMessageBar *bar ) { mMessageBar = bar; }
74 
79  QgsMessageBar *messageBar() const { return mMessageBar; }
80 
81  private:
82 
83  QString mAnnotationId;
84  QgsMapCanvas *mMapCanvas = nullptr;
85  QgsMessageBar *mMessageBar = nullptr;
86 
87 };
88 
89 
96 class GUI_EXPORT QgsMapLayerConfigWidget : public QgsPanelWidget
97 {
98  Q_OBJECT
99  public:
100 
109  QgsMapLayerConfigWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
110 
117  virtual bool shouldTriggerLayerRepaint() const { return true; }
118 
123  virtual void syncToLayer( QgsMapLayer *layer ) { Q_UNUSED( layer ) }
124 
130  virtual void setMapLayerConfigWidgetContext( const QgsMapLayerConfigWidgetContext &context );
131 
132  public slots:
133 
138  virtual void apply() = 0;
139 
145  virtual void focusDefaultWidget();
146 
147  signals:
148 
149 #ifndef SIP_RUN
150 
158  void dynamicTemporalControlToggled( bool enabled );
159 #endif
160 
161  protected:
162 
163  QgsMapLayer *mLayer = nullptr;
164  QgsMapCanvas *mMapCanvas = nullptr;
166 };
167 
168 #endif // QGSMAPLAYERCONFIGWIDGET_H
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
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.