QGIS API Documentation  2.99.0-Master (0a63d1f)
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 #include "qgis_gui.h"
25 
26 class QgsSymbol;
27 class QgsStyle;
28 
29 class QMenu;
30 
34 class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListWidget, private QgsExpressionContextGenerator
35 {
36  Q_OBJECT
37 
38  public:
39  QgsSymbolsListWidget( QgsSymbol* symbol, QgsStyle* style, QMenu* menu, QWidget* parent, const QgsVectorLayer * layer = nullptr );
40 
41 
42  virtual ~QgsSymbolsListWidget();
43 
49  void setContext( const QgsSymbolWidgetContext& context );
50 
55  QgsSymbolWidgetContext context() const;
56 
60  const QgsVectorLayer* layer() const { return mLayer; }
61 
62  public slots:
63 
64  void setSymbolFromStyle( const QModelIndex & index );
65  void setSymbolColor( const QColor& color );
66  void setMarkerAngle( double angle );
67  void setMarkerSize( double size );
68  void setLineWidth( double width );
69  void addSymbolToStyle();
70  void saveSymbol();
71 
72  void symbolAddedToStyle( const QString& name, QgsSymbol* symbol );
73 
74  void on_mSymbolUnitWidget_changed();
75  void on_mTransparencySlider_valueChanged( int value );
76 
78  void populateGroups();
79  void on_groupsCombo_currentIndexChanged( int index );
80 
81  void openStyleManager();
82  void clipFeaturesToggled( bool checked );
83 
84  void updateDataDefinedMarkerSize();
85  void updateDataDefinedMarkerAngle();
86  void updateDataDefinedLineWidth();
87 
88  signals:
89  void changed();
90 
91  private:
92  QgsSymbol* mSymbol;
93  QgsStyle* mStyle;
94  QMenu* mAdvancedMenu;
95  QAction* mClipFeaturesAction;
96  const QgsVectorLayer* mLayer;
97  QgsMapCanvas* mMapCanvas;
98 
99  void populateSymbolView();
100  void populateSymbols( const QStringList& symbols );
101  void updateSymbolColor();
102  void updateSymbolInfo();
103 
105  void displayTransparency( double alpha );
106 
107  QgsSymbolWidgetContext mContext;
108 
110 };
111 
112 #endif //QGSSYMBOLSLISTWIDGET_H
113 
114 
115 
static unsigned index
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
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