QGIS API Documentation 3.99.0-Master (21b3aa880ba)
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 "qgis_gui.h"
19#include "qgslayertreegroup.h"
20#include "qgspanelwidget.h"
21
22#include <QIcon>
23#include <QPointer>
24#include <QWidget>
25
26class QgsMapCanvas;
27class QgsMapLayer;
28class 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 QString mAnnotationId;
101 QgsMapCanvas *mMapCanvas = nullptr;
102 QgsMessageBar *mMessageBar = nullptr;
103 QPointer<QgsLayerTreeGroup> mLayerTreeGroup = nullptr;
104};
105
106
113{
114 Q_OBJECT
115 public:
116
125 QgsMapLayerConfigWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
126
133 virtual bool shouldTriggerLayerRepaint() const { return true; }
134
135#ifdef __GNUC__
136#pragma GCC diagnostic push
137#pragma GCC diagnostic ignored "-Woverloaded-virtual"
138#endif
139
144 virtual void syncToLayer( QgsMapLayer *layer ) { Q_UNUSED( layer ) }
145#ifdef __GNUC__
146#pragma GCC diagnostic pop
147#endif
148
154 virtual void setMapLayerConfigWidgetContext( const QgsMapLayerConfigWidgetContext &context );
155
156 public slots:
157
162 virtual void apply() = 0;
163
169 virtual void focusDefaultWidget();
170
171 signals:
172
173#ifndef SIP_RUN
174
182 void dynamicTemporalControlToggled( bool enabled );
183#endif
184
185 protected:
186 QgsMapLayer *mLayer = nullptr;
189};
190
191#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.
QgsMapLayerConfigWidget(QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent=nullptr)
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 void focusDefaultWidget()
Focuses the default widget for the page.
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:80
A bar for displaying non-blocking messages to the user.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.