QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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
QgsMapLayerConfigWidgetContext::setMessageBar
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
Definition: qgsmaplayerconfigwidget.h:75
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
QgsMapLayerConfigWidget
A panel widget that can be shown in the map style dock.
Definition: qgsmaplayerconfigwidget.h:115
QgsMapLayerConfigWidgetContext::annotationId
QString annotationId() const
Returns the item ID of the target annotation, when modifying an annotation from a QgsAnnotationLayer.
Definition: qgsmaplayerconfigwidget.h:46
QgsMapLayerConfigWidgetContext::setMapCanvas
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
Definition: qgsmaplayerconfigwidget.h:62
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsMapLayerConfigWidgetContext::messageBar
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
Definition: qgsmaplayerconfigwidget.h:81
qgslayertreegroup.h
QgsLayerTreeGroup
Layer tree group node serves as a container for layers and further groups.
Definition: qgslayertreegroup.h:40
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:60
QgsMapLayerConfigWidgetContext
Encapsulates the context for a QgsMapLayerConfigWidget.
Definition: qgsmaplayerconfigwidget.h:36
QgsMapLayerConfigWidget::shouldTriggerLayerRepaint
virtual bool shouldTriggerLayerRepaint() const
Whether this config widget changes map layer properties in a way that triggerRepaint() should be call...
Definition: qgsmaplayerconfigwidget.h:136
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition: qgsmaplayer.h:72
QgsMapLayerConfigWidget::syncToLayer
virtual void syncToLayer(QgsMapLayer *layer)
Reset to original (vector layer) values.
Definition: qgsmaplayerconfigwidget.h:142
QgsMapLayerConfigWidgetContext::setAnnotationId
void setAnnotationId(const QString &id)
Sets the item id of the target annotation, when modifying an annotation from a QgsAnnotationLayer.
Definition: qgsmaplayerconfigwidget.h:54
QgsMapLayerConfigWidget::mMapLayerConfigWidgetContext
QgsMapLayerConfigWidgetContext mMapLayerConfigWidgetContext
Definition: qgsmaplayerconfigwidget.h:184
qgspanelwidget.h
QgsMapLayerConfigWidgetContext::mapCanvas
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Definition: qgsmaplayerconfigwidget.h:68