QGIS API Documentation  3.17.0-Master (8af46bc54f)
qgssymbolwidgetcontext.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbolwidgetcontext.h
3  ------------------------
4  begin : September 2016
5  copyright : (C) 2016 by Nyall Dawson
6  email : nyall dot dawson 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 QGSSYMBOLWIDGETCONTEXT_H
16 #define QGSSYMBOLWIDGETCONTEXT_H
17 
18 #include <memory>
19 
20 #include "qgsexpressioncontext.h"
21 #include "qgis_gui.h"
22 
23 
24 class QgsMapCanvas;
25 class QgsMessageBar;
26 
35 class GUI_EXPORT QgsSymbolWidgetContext // clazy:exclude=rule-of-three
36 {
37  public:
38 
42  QgsSymbolWidgetContext() = default;
43 
49 
50  QgsSymbolWidgetContext &operator=( const QgsSymbolWidgetContext &other );
51 
58  void setMapCanvas( QgsMapCanvas *canvas );
59 
64  QgsMapCanvas *mapCanvas() const;
65 
72  void setMessageBar( QgsMessageBar *bar );
73 
79  QgsMessageBar *messageBar() const;
80 
89  void setExpressionContext( QgsExpressionContext *context );
90 
97  QgsExpressionContext *expressionContext() const;
98 
104  void setAdditionalExpressionContextScopes( const QList< QgsExpressionContextScope > &scopes );
105 
110  QList< QgsExpressionContextScope > additionalExpressionContextScopes() const;
111 
117  QList<QgsExpressionContextScope *> globalProjectAtlasMapLayerScopes( const QgsMapLayer *layer ) const SIP_FACTORY;
118 
119  private:
120 
121  QgsMapCanvas *mMapCanvas = nullptr;
122  QgsMessageBar *mMessageBar = nullptr;
123  std::unique_ptr< QgsExpressionContext > mExpressionContext;
124  QList< QgsExpressionContextScope > mAdditionalScopes;
125 
126 };
127 
128 #endif // QGSSYMBOLWIDGETCONTEXT_H
Base class for all map layer types.
Definition: qgsmaplayer.h:83
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:60
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:84
Contains settings which reflect the context in which a symbol (or renderer) widget is shown...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
#define SIP_FACTORY
Definition: qgis_sip.h:76