QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
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 #include "qgsstylemodel.h"
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  ~QgsSymbolsListWidget() override;
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 setSymbolColor( const QColor &color );
79  void setMarkerAngle( double angle );
80  void setMarkerSize( double size );
81  void setLineWidth( double width );
82 
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  void setSymbolFromStyle( const QString &name, QgsStyle::StyleEntity type );
94  void mSymbolUnitWidget_changed();
95  void updateAssistantSymbol();
96  void opacityChanged( double value );
97  void createAuxiliaryField();
98  void createSymbolAuxiliaryField();
99  void forceRHRToggled( bool checked );
100  void saveSymbol();
101  void updateSymbolDataDefinedProperty();
102 
103  private:
104 
105  void registerSymbolDataDefinedButton( QgsPropertyOverrideButton *button, QgsSymbol::Property key );
106 
107  QgsSymbol *mSymbol = nullptr;
108  std::shared_ptr< QgsSymbol > mAssistantSymbol;
109  QgsStyle *mStyle = nullptr;
110  QMenu *mAdvancedMenu = nullptr;
111  QAction *mClipFeaturesAction = nullptr;
112  QAction *mStandardizeRingsAction = nullptr;
113  QgsVectorLayer *mLayer = nullptr;
114  QgsMapCanvas *mMapCanvas = nullptr;
115 
116  QgsColorButton *mSymbolColorButton = nullptr;
117  QgsOpacityWidget *mSymbolOpacityWidget = nullptr;
118  QgsUnitSelectionWidget *mSymbolUnitWidget = nullptr;
119 
120  void updateSymbolColor();
121  void updateSymbolInfo();
122  QgsSymbolWidgetContext mContext;
123 
125  void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsSymbolLayer::Property key );
126 };
127 
128 #endif //QGSSYMBOLSLISTWIDGET_H
129 
130 
131 
A cross platform button subclass for selecting colors.
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:86
A widget for setting an opacity value.
A button for controlling property overrides which may apply to a widget.
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:179
Property
Data definable properties.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:65
Property
Data definable properties.
Definition: qgssymbol.h:116
const QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
A widget displaying a combobox allowing the user to choose between various display units,...
Represents a vector layer which manages a vector based data sets.
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
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53