QGIS API Documentation 3.99.0-Master (21b3aa880ba)
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:
40
45 QgsPlotWidget( QWidget *parent = nullptr )
46 : QgsPanelWidget( parent )
47 {}
48
53 virtual void setPlot( QgsPlot *plot ) = 0;
54
60
66
68
69 protected:
70
75
80
82
83 private slots:
84
85 void updateProperty();
86
87 private:
88 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
89};
90
91
92//
93// QgsBarChartPlotWidget
94//
95
96#include "ui_qgsbarchartplotwidgetbase.h"
97
104class GUI_EXPORT QgsBarChartPlotWidget : public QgsPlotWidget, private Ui::QgsBarChartPlotWidgetBase
105{
106 Q_OBJECT
107
108 public:
109
114 QgsBarChartPlotWidget( QWidget *parent = nullptr );
115
116 void setPlot( QgsPlot *plot ) override;
117 QgsPlot *createPlot() override SIP_FACTORY;
118
120 static QgsPlotWidget *create( QWidget *parent ) SIP_FACTORY { return new QgsBarChartPlotWidget( parent ); }
121
122 private slots:
123 void mAddSymbolPushButton_clicked();
124 void mRemoveSymbolPushButton_clicked();
125
126 private:
127 int mBlockChanges = 0;
128
129 std::unique_ptr< QgsNumericFormat > mXAxisNumericFormat;
130 std::unique_ptr< QgsNumericFormat > mYAxisNumericFormat;
131};
132
133
134//
135// QgsLineChartPlotWidget
136//
137
138#include "ui_qgslinechartplotwidgetbase.h"
139
146class GUI_EXPORT QgsLineChartPlotWidget : public QgsPlotWidget, private Ui::QgsLineChartPlotWidgetBase
147{
148 Q_OBJECT
149
150 public:
151
156 QgsLineChartPlotWidget( QWidget *parent = nullptr );
157
158 void setPlot( QgsPlot *plot ) override;
159 QgsPlot *createPlot() override SIP_FACTORY;
160
162 static QgsPlotWidget *create( QWidget *parent ) SIP_FACTORY { return new QgsLineChartPlotWidget( parent ); }
163
164 private slots:
165 void mAddSymbolPushButton_clicked();
166 void mRemoveSymbolPushButton_clicked();
167
168 private:
169 int mBlockChanges = 0;
170
171 std::unique_ptr< QgsNumericFormat > mXAxisNumericFormat;
172 std::unique_ptr< QgsNumericFormat > mYAxisNumericFormat;
173};
174
175//
176// QgsLineChartPlotWidget
177//
178
179#include "ui_qgspiechartplotwidgetbase.h"
180
187class GUI_EXPORT QgsPieChartPlotWidget : public QgsPlotWidget, private Ui::QgsPieChartPlotWidgetBase
188{
189 Q_OBJECT
190
191 public:
192
197 QgsPieChartPlotWidget( QWidget *parent = nullptr );
198
199 void setPlot( QgsPlot *plot ) override;
200 QgsPlot *createPlot() override SIP_FACTORY;
201
203 static QgsPlotWidget *create( QWidget *parent ) SIP_FACTORY { return new QgsPieChartPlotWidget( parent ); }
204
205 private slots:
206 void mAddSymbolPushButton_clicked();
207 void mRemoveSymbolPushButton_clicked();
208
209 private:
210 int mBlockChanges = 0;
211
212 std::unique_ptr< QgsNumericFormat > mNumericFormat;
213};
214
215#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