QGIS API Documentation  2.99.0-Master (9ed189e)
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 #include "qgssymbollayer.h"
23 
24 #include <QWidget>
25 #include "qgis_gui.h"
26 
27 class QgsSymbol;
28 class QgsStyle;
29 
30 class QMenu;
31 
35 class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListWidget, private QgsExpressionContextGenerator
36 {
37  Q_OBJECT
38 
39  public:
40  QgsSymbolsListWidget( QgsSymbol* symbol, QgsStyle* style, QMenu* menu, QWidget* parent, const QgsVectorLayer * layer = nullptr );
41 
42 
43  virtual ~QgsSymbolsListWidget();
44 
50  void setContext( const QgsSymbolWidgetContext& context );
51 
56  QgsSymbolWidgetContext context() const;
57 
61  const QgsVectorLayer* layer() const { return mLayer; }
62 
63  public slots:
64 
65  void setSymbolFromStyle( const QModelIndex & index );
66  void setSymbolColor( const QColor& color );
67  void setMarkerAngle( double angle );
68  void setMarkerSize( double size );
69  void setLineWidth( double width );
70  void addSymbolToStyle();
71  void saveSymbol();
72 
73  void symbolAddedToStyle( const QString& name, QgsSymbol* symbol );
74 
75  void on_mSymbolUnitWidget_changed();
76  void on_mTransparencySlider_valueChanged( int value );
77 
79  void populateGroups();
80  void on_groupsCombo_currentIndexChanged( int index );
81 
82  void openStyleManager();
83  void clipFeaturesToggled( bool checked );
84 
85  void updateDataDefinedMarkerSize();
86  void updateDataDefinedMarkerAngle();
87  void updateDataDefinedLineWidth();
88 
89  signals:
90  void changed();
91 
92  private slots:
93 
94  void updateAssistantSymbol();
95 
96  private:
97  QgsSymbol* mSymbol = nullptr;
98  std::shared_ptr< QgsSymbol > mAssistantSymbol;
99  QgsStyle* mStyle = nullptr;
100  QMenu* mAdvancedMenu = nullptr;
101  QAction* mClipFeaturesAction = nullptr;
102  const QgsVectorLayer* mLayer = nullptr;
103  QgsMapCanvas* mMapCanvas = nullptr;
104 
105  void populateSymbolView();
106  void populateSymbols( const QStringList& symbols );
107  void updateSymbolColor();
108  void updateSymbolInfo();
109 
111  void displayTransparency( double alpha );
112 
113  QgsSymbolWidgetContext mContext;
114 
116  void registerDataDefinedButton( QgsPropertyOverrideButton* button, QgsSymbolLayer::Property key );
117 };
118 
119 #endif //QGSSYMBOLSLISTWIDGET_H
120 
121 
122 
static unsigned index
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:72
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
A button for controlling property overrides which may apply to a widget.
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
Property
Data definable properties.