QGIS API Documentation  2.99.0-Master (19b062c)
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 
36 class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListWidget, private QgsExpressionContextGenerator
37 {
38  Q_OBJECT
39 
40  public:
41 
50  QgsSymbolsListWidget( QgsSymbol *symbol, QgsStyle *style, QMenu *menu, QWidget *parent SIP_TRANSFERTHIS, QgsVectorLayer *layer = nullptr );
51 
52 
53  virtual ~QgsSymbolsListWidget();
54 
61  void setContext( const QgsSymbolWidgetContext &context );
62 
68  QgsSymbolWidgetContext context() const;
69 
74  const QgsVectorLayer *layer() const { return mLayer; }
75 
76  public slots:
77 
78  void setSymbolFromStyle( const QModelIndex &index );
79  void setSymbolColor( const QColor &color );
80  void setMarkerAngle( double angle );
81  void setMarkerSize( double size );
82  void setLineWidth( double width );
83  void addSymbolToStyle();
84  void saveSymbol();
85 
86  void symbolAddedToStyle( const QString &name, QgsSymbol *symbol );
87 
89  void populateGroups();
90 
91  void openStyleManager();
92  void clipFeaturesToggled( bool checked );
93 
94  void updateDataDefinedMarkerSize();
95  void updateDataDefinedMarkerAngle();
96  void updateDataDefinedLineWidth();
97 
98  signals:
99  void changed();
100 
101  private slots:
102  void mSymbolUnitWidget_changed();
103  void groupsCombo_currentIndexChanged( int index );
104  void updateAssistantSymbol();
105  void opacityChanged( double value );
106  void createAuxiliaryField();
107 
108  private:
109  QgsSymbol *mSymbol = nullptr;
110  std::shared_ptr< QgsSymbol > mAssistantSymbol;
111  QgsStyle *mStyle = nullptr;
112  QMenu *mAdvancedMenu = nullptr;
113  QAction *mClipFeaturesAction = nullptr;
114  QgsVectorLayer *mLayer = nullptr;
115  QgsMapCanvas *mMapCanvas = nullptr;
116 
117  void populateSymbolView();
118  void populateSymbols( const QStringList &symbols );
119  void updateSymbolColor();
120  void updateSymbolInfo();
121  QgsSymbolWidgetContext mContext;
122 
124  void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsSymbolLayer::Property key );
125 };
126 
127 #endif //QGSSYMBOLSLISTWIDGET_H
128 
129 
130 
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cpp:786
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.
Property
Data definable properties.