QGIS API Documentation  2.99.0-Master (7705179)
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 SIP_TRANSFERTHIS, 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 
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 slots:
92 
93  void updateAssistantSymbol();
94  void opacityChanged( double value );
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  QgsSymbolWidgetContext mContext;
110 
112  void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsSymbolLayer::Property key );
113 };
114 
115 #endif //QGSSYMBOLSLISTWIDGET_H
116 
117 
118 
#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:73
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.