QGIS API Documentation 3.99.0-Master (752b475928d)
Loading...
Searching...
No Matches
qgsplotwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsplotwidget.h
3 ---------------
4 begin : August 2025
5 copyright : (C) 2025 by Mathieu Pellerin
6 email : mathieu dot opengis dot ch
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#ifndef QGSPLOTWIDGET_H
16#define QGSPLOTWIDGET_H
17
18#include "qgis_sip.h"
21#include "qgsnumericformat.h"
22#include "qgspanelwidget.h"
23#include "qgsplot.h"
26
27#include <QWidget>
28
36{
37 Q_OBJECT
38
39 public:
44 QgsPlotWidget( QWidget *parent = nullptr )
45 : QgsPanelWidget( parent )
46 {}
47
52 virtual void setPlot( QgsPlot *plot ) = 0;
53
59
65
67
68 protected:
73
78
80
81 private slots:
82
83 void updateProperty();
84
85 private:
86 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
87};
88
89
90//
91// QgsBarChartPlotWidget
92//
93
94#include "ui_qgsbarchartplotwidgetbase.h"
95
102class GUI_EXPORT QgsBarChartPlotWidget : public QgsPlotWidget, private Ui::QgsBarChartPlotWidgetBase
103{
104 Q_OBJECT
105
106 public:
111 QgsBarChartPlotWidget( QWidget *parent = nullptr );
112
113 void setPlot( QgsPlot *plot ) override;
114 QgsPlot *createPlot() override SIP_FACTORY;
115
117 static QgsPlotWidget *create( QWidget *parent ) SIP_FACTORY { return new QgsBarChartPlotWidget( parent ); }
118
119 private slots:
120 void mAddSymbolPushButton_clicked();
121 void mRemoveSymbolPushButton_clicked();
122
123 private:
124 int mBlockChanges = 0;
125
126 std::unique_ptr< QgsNumericFormat > mXAxisNumericFormat;
127 std::unique_ptr< QgsNumericFormat > mYAxisNumericFormat;
128};
129
130
131//
132// QgsLineChartPlotWidget
133//
134
135#include "ui_qgslinechartplotwidgetbase.h"
136
143class GUI_EXPORT QgsLineChartPlotWidget : public QgsPlotWidget, private Ui::QgsLineChartPlotWidgetBase
144{
145 Q_OBJECT
146
147 public:
152 QgsLineChartPlotWidget( QWidget *parent = nullptr );
153
154 void setPlot( QgsPlot *plot ) override;
155 QgsPlot *createPlot() override SIP_FACTORY;
156
158 static QgsPlotWidget *create( QWidget *parent ) SIP_FACTORY { return new QgsLineChartPlotWidget( parent ); }
159
160 private slots:
161 void mAddSymbolPushButton_clicked();
162 void mRemoveSymbolPushButton_clicked();
163
164 private:
165 int mBlockChanges = 0;
166
167 std::unique_ptr< QgsNumericFormat > mXAxisNumericFormat;
168 std::unique_ptr< QgsNumericFormat > mYAxisNumericFormat;
169};
170
171//
172// QgsLineChartPlotWidget
173//
174
175#include "ui_qgspiechartplotwidgetbase.h"
176
183class GUI_EXPORT QgsPieChartPlotWidget : public QgsPlotWidget, private Ui::QgsPieChartPlotWidgetBase
184{
185 Q_OBJECT
186
187 public:
192 QgsPieChartPlotWidget( QWidget *parent = nullptr );
193
194 void setPlot( QgsPlot *plot ) override;
195 QgsPlot *createPlot() override SIP_FACTORY;
196
198 static QgsPlotWidget *create( QWidget *parent ) SIP_FACTORY { return new QgsPieChartPlotWidget( parent ); }
199
200 private slots:
201 void mAddSymbolPushButton_clicked();
202 void mRemoveSymbolPushButton_clicked();
203
204 private:
205 int mBlockChanges = 0;
206
207 std::unique_ptr< QgsNumericFormat > mNumericFormat;
208};
209
210#endif //QGSPLOTWIDGET_H
void setPlot(QgsPlot *plot) override
Sets the widget to match the settings of the plot.
static QgsPlotWidget * create(QWidget *parent)
Creates a new bar chart plot configuration widget.
QgsBarChartPlotWidget(QWidget *parent=nullptr)
Constructor for QgsBarChartPlotWidget.
QgsPlot * createPlot() override
Creates a plot defined by the current settings in the widget.
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...
QgsLineChartPlotWidget(QWidget *parent=nullptr)
Constructor for QgsLineChartPlotWidget.
void setPlot(QgsPlot *plot) override
Sets the widget to match the settings of the plot.
static QgsPlotWidget * create(QWidget *parent)
Creates a new line chart plot configuration widget.
QgsPlot * createPlot() override
Creates a plot defined by the current settings in the widget.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
QgsPlot * createPlot() override
Creates a plot defined by the current settings in the widget.
static QgsPlotWidget * create(QWidget *parent)
Creates a new line chart plot configuration widget.
void setPlot(QgsPlot *plot) override
Sets the widget to match the settings of the plot.
QgsPieChartPlotWidget(QWidget *parent=nullptr)
Constructor for QgsLineChartPlotWidget.
void registerExpressionContextGenerator(QgsExpressionContextGenerator *generator)
Register an expression context generator class that will be used to retrieve an expression context fo...
QgsPropertyCollection mPropertyCollection
virtual QgsPlot * createPlot()=0
Creates a plot defined by the current settings in the widget.
void updateDataDefinedButton(QgsPropertyOverrideButton *button)
Initiate a data-defined property button tied to a plot widget.
QgsPlotWidget(QWidget *parent=nullptr)
Constructor for QgsPlotWidget.
virtual void setPlot(QgsPlot *plot)=0
Sets the widget to match the settings of the plot.
void initializeDataDefinedButton(QgsPropertyOverrideButton *button, QgsPlot::DataDefinedProperty key)
Initiate a data-defined property button tied to a plot widget.
Base class for plot/chart/graphs.
Definition qgsplot.h:48
DataDefinedProperty
Data defined properties for different plot types.
Definition qgsplot.h:96
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
A button for controlling property overrides which may apply to a widget.
#define SIP_FACTORY
Definition qgis_sip.h:84