QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 "qgsstylemodel.h"
23 #include <QWidget>
24 #include "qgis_gui.h"
25 
26 class QgsSymbol;
27 class QgsStyle;
28 
29 class QMenu;
30 
35 class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListWidget, private QgsExpressionContextGenerator
36 {
37  Q_OBJECT
38 
39  public:
40 
49  QgsSymbolsListWidget( QgsSymbol *symbol, QgsStyle *style, QMenu *menu, QWidget *parent SIP_TRANSFERTHIS, QgsVectorLayer *layer = nullptr );
50 
51 
52  ~QgsSymbolsListWidget() override;
53 
60  void setContext( const QgsSymbolWidgetContext &context );
61 
67  QgsSymbolWidgetContext context() const;
68 
73  const QgsVectorLayer *layer() const { return mLayer; }
74 
75  public slots:
76 
77  void setSymbolColor( const QColor &color );
78  void setMarkerAngle( double angle );
79  void setMarkerSize( double size );
80  void setLineWidth( double width );
81 
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  void setSymbolFromStyle( const QString &name, QgsStyle::StyleEntity type, const QString &stylePath );
93  void mSymbolUnitWidget_changed();
94  void updateAssistantSymbol();
95  void opacityChanged( double value );
96  void createAuxiliaryField();
97  void createSymbolAuxiliaryField();
98  void forceRHRToggled( bool checked );
99  void showAnimationSettings();
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  QAction *mAnimationSettingsAction = nullptr;
114  QgsVectorLayer *mLayer = nullptr;
115  QgsMapCanvas *mMapCanvas = nullptr;
116 
117  QgsColorButton *mSymbolColorButton = nullptr;
118  QgsOpacityWidget *mSymbolOpacityWidget = nullptr;
119  QgsUnitSelectionWidget *mSymbolUnitWidget = nullptr;
120 
121  void updateSymbolColor();
122  void updateSymbolInfo();
123  QgsSymbolWidgetContext mContext;
124 
126  void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsSymbolLayer::Property key );
127 };
128 
129 #endif //QGSSYMBOLSLISTWIDGET_H
130 
131 
132 
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:406
QgsSymbolWidgetContext
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Definition: qgssymbolwidgetcontext.h:35
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:92
qgssymbolwidgetcontext.h
QgsPropertyOverrideButton
A button for controlling property overrides which may apply to a widget.
Definition: qgspropertyoverridebutton.h:50
QgsExpressionContextGenerator::createExpressionContext
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
qgsstylemodel.h
QgsOpacityWidget
A widget for setting an opacity value.
Definition: qgsopacitywidget.h:32
QgsSymbolsListWidget::layer
const QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
Definition: qgssymbolslistwidget.h:73
QgsStyle
Definition: qgsstyle.h:159
QgsSymbol::Property
Property
Data definable properties.
Definition: qgssymbol.h:129
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsSymbolsListWidget
Definition: qgssymbolslistwidget.h:35
QgsColorButton
A cross platform button subclass for selecting colors. Will open a color chooser dialog when clicked....
Definition: qgscolorbutton.h:35
QgsSymbolLayer::Property
Property
Data definable properties.
Definition: qgssymbollayer.h:142
QgsExpressionContextGenerator
Abstract interface for generating an expression context.
Definition: qgsexpressioncontextgenerator.h:36
MathUtils::angle
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
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsStyle::StyleEntity
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:178