QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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
26class QgsMapCanvas;
27class QgsMapLayer;
28class QgsMessageBar;
29
37{
38 public:
45 QString annotationId() const { return mAnnotationId; }
46
53 void setAnnotationId( const QString &id ) { mAnnotationId = id; }
54
61 void setMapCanvas( QgsMapCanvas *canvas ) { mMapCanvas = canvas; }
62
67 QgsMapCanvas *mapCanvas() const { return mMapCanvas; }
68
74 void setMessageBar( QgsMessageBar *bar ) { mMessageBar = bar; }
75
80 QgsMessageBar *messageBar() const { return mMessageBar; }
81
88 void setLayerTreeGroup( QgsLayerTreeGroup *group );
89
96 QgsLayerTreeGroup *layerTreeGroup() const;
97
98 private:
99 QString mAnnotationId;
100 QgsMapCanvas *mMapCanvas = nullptr;
101 QgsMessageBar *mMessageBar = nullptr;
102 QPointer<QgsLayerTreeGroup> mLayerTreeGroup = nullptr;
103};
104
105
112{
113 Q_OBJECT
114 public:
123 QgsMapLayerConfigWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
124
131 virtual bool shouldTriggerLayerRepaint() const { return true; }
132
133#ifdef __GNUC__
134#pragma GCC diagnostic push
135#pragma GCC diagnostic ignored "-Woverloaded-virtual"
136#endif
137
142 virtual void syncToLayer( QgsMapLayer *layer ) { Q_UNUSED( layer ) }
143#ifdef __GNUC__
144#pragma GCC diagnostic pop
145#endif
146
152 virtual void setMapLayerConfigWidgetContext( const QgsMapLayerConfigWidgetContext &context );
153
154 public slots:
155
160 virtual void apply() = 0;
161
167 virtual void focusDefaultWidget();
168
169 signals:
170
171#ifndef SIP_RUN
172
180 void dynamicTemporalControlToggled( bool enabled );
181#endif
182
183 protected:
184 QgsMapLayer *mLayer = nullptr;
185 QgsMapCanvas *mMapCanvas = nullptr;
187};
188
189#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.
Encapsulates the context for a QgsMapLayerConfigWidget.
void setAnnotationId(const QString &id)
Sets the item id of the target annotation, when modifying an annotation from a QgsAnnotationLayer.
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
QgsMapCanvas * mapCanvas() const
Returns the map canvas 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:76
A bar for displaying non-blocking messages to the user.
Base class for any widget that can be shown as a inline panel.