QGIS API Documentation  2.99.0-Master (8ec3eaf)
qgssymbolslistwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbolslistwidget.h
3  ---------------------
4  begin : June 2012
5  copyright : (C) 2012 by Arunmozhi
6  email : aruntheguy at gmail.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 
16 #ifndef QGSSYMBOLSLISTWIDGET_H
17 #define QGSSYMBOLSLISTWIDGET_H
18 
19 #include "ui_widget_symbolslist.h"
20 
21 #include "qgssymbolwidgetcontext.h"
22 
23 #include <QWidget>
24 
25 class QgsSymbol;
26 class QgsStyle;
27 
28 class QMenu;
29 
33 class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListWidget, private QgsExpressionContextGenerator
34 {
35  Q_OBJECT
36 
37  public:
38  QgsSymbolsListWidget( QgsSymbol* symbol, QgsStyle* style, QMenu* menu, QWidget* parent, const QgsVectorLayer * layer = nullptr );
39 
41  virtual ~QgsSymbolsListWidget();
42 
48  void setContext( const QgsSymbolWidgetContext& context );
49 
54  QgsSymbolWidgetContext context() const;
55 
59  const QgsVectorLayer* layer() const { return mLayer; }
60 
61  public slots:
62 
63  void setSymbolFromStyle( const QModelIndex & index );
64  void setSymbolColor( const QColor& color );
65  void setMarkerAngle( double angle );
66  void setMarkerSize( double size );
67  void setLineWidth( double width );
68  void addSymbolToStyle();
69  void saveSymbol();
70 
71  void symbolAddedToStyle( const QString& name, QgsSymbol* symbol );
72 
73  void on_mSymbolUnitWidget_changed();
74  void on_mTransparencySlider_valueChanged( int value );
75 
77  void populateGroups();
78  void on_groupsCombo_currentIndexChanged( int index );
79 
80  void openStyleManager();
81  void clipFeaturesToggled( bool checked );
82 
83  void updateDataDefinedMarkerSize();
84  void updateDataDefinedMarkerAngle();
85  void updateDataDefinedLineWidth();
86 
87  signals:
88  void changed();
89 
90  private:
91  QgsSymbol* mSymbol;
92  QgsStyle* mStyle;
93  QMenu* mAdvancedMenu;
94  QAction* mClipFeaturesAction;
95  const QgsVectorLayer* mLayer;
96  QgsMapCanvas* mMapCanvas;
97 
98  void populateSymbolView();
99  void populateSymbols( const QStringList& symbols );
100  void updateSymbolColor();
101  void updateSymbolInfo();
102 
104  void displayTransparency( double alpha );
105 
106  QgsSymbolWidgetContext mContext;
107 
109 };
110 
111 #endif //QGSSYMBOLSLISTWIDGET_H
112 
113 
114 
static unsigned index
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:106
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
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...
const QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
Abstract interface for generating an expression context.
Represents a vector layer which manages a vector based data sets.
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cc:857