QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsnumericformatwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsnumericformatwidget.h
3 ------------------------
4 begin : January 2020
5 copyright : (C) 2020 by Nyall Dawson
6 email : nyall dot dawson at gmail dot 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#ifndef QGSNUMERICFORMATWIDGET_H
16#define QGSNUMERICFORMATWIDGET_H
17
18#include <memory>
19
20#include "qgis_sip.h"
22#include "qgsnumericformat.h"
23#include "qgspanelwidget.h"
24
25#include <QDialog>
26
29
37{
38 Q_OBJECT
39
40 public:
41
45 QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr )
46 : QgsPanelWidget( parent )
47 {}
48
53 virtual void setFormat( QgsNumericFormat *format ) = 0;
54
63
71
73
74 signals:
75
79 void changed();
80
81 private:
82 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
83};
84
85
86#include "ui_qgsbasicnumericformatwidgetbase.h"
87
89
96class GUI_EXPORT QgsBasicNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBasicNumericFormatWidgetBase
97{
98 Q_OBJECT
99
100 public:
101
105 QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
107
108 void setFormat( QgsNumericFormat *format ) final;
109
111
112 private:
113 std::unique_ptr<QgsBasicNumericFormat> mFormat;
114 bool mBlockSignals = false;
115};
116
117#include "ui_qgsbearingnumericformatwidgetbase.h"
118
120
127class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
128{
129 Q_OBJECT
130
131 public:
132
136 QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
138
139 void setFormat( QgsNumericFormat *format ) final;
140
142
143 private:
144 std::unique_ptr<QgsBearingNumericFormat> mFormat;
145 bool mBlockSignals = false;
146};
147
148
155class GUI_EXPORT QgsBearingNumericFormatDialog : public QDialog
156{
157 Q_OBJECT
158
159 public:
160
164 QgsBearingNumericFormatDialog( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
165
172
173 private:
174 QgsBearingNumericFormatWidget *mWidget = nullptr;
175};
176
177
178#include "ui_qgsgeographiccoordinatenumericformatwidgetbase.h"
179
181
188class GUI_EXPORT QgsGeographicCoordinateNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsGeographicCoordinateNumericFormatWidgetBase
189{
190 Q_OBJECT
191
192 public:
193
197 QgsGeographicCoordinateNumericFormatWidget( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
199
200 void setFormat( QgsNumericFormat *format ) final;
201
203
204 private:
205 std::unique_ptr<QgsGeographicCoordinateNumericFormat> mFormat;
206 bool mBlockSignals = false;
207};
208
209
216class GUI_EXPORT QgsGeographicCoordinateNumericFormatDialog : public QDialog
217{
218 Q_OBJECT
219
220 public:
221
225 QgsGeographicCoordinateNumericFormatDialog( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
226
233
234 private:
236};
237
238
239#include "ui_qgscurrencynumericformatwidgetbase.h"
240
242
249class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
250{
251 Q_OBJECT
252
253 public:
254
258 QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
260
261 void setFormat( QgsNumericFormat *format ) final;
262
264
265 private:
266 std::unique_ptr<QgsCurrencyNumericFormat> mFormat;
267 bool mBlockSignals = false;
268};
269
270
271#include "ui_qgspercentagenumericformatwidgetbase.h"
272
274
281class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
282{
283 Q_OBJECT
284
285 public:
286
292
293 void setFormat( QgsNumericFormat *format ) final;
294
296
297 private:
298 std::unique_ptr<QgsPercentageNumericFormat> mFormat;
299 bool mBlockSignals = false;
300};
301
302
303#include "ui_qgsscientificnumericformatwidgetbase.h"
304
306
313class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
314{
315 Q_OBJECT
316
317 public:
318
324
325 void setFormat( QgsNumericFormat *format ) final;
326
328
329 private:
330 std::unique_ptr<QgsScientificNumericFormat> mFormat;
331 bool mBlockSignals = false;
332};
333
334
335#include "ui_qgsfractionnumericformatwidgetbase.h"
336
343class GUI_EXPORT QgsFractionNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsFractionNumericFormatWidgetBase
344{
345 Q_OBJECT
346
347 public:
348
352 QgsFractionNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
354
355 void setFormat( QgsNumericFormat *format ) final;
356
358
359 private:
360 std::unique_ptr<QgsFractionNumericFormat> mFormat;
361 bool mBlockSignals = false;
362};
363
364
365#include "ui_qgsexpressionbasednumericformatwidgetbase.h"
366
373class GUI_EXPORT QgsExpressionBasedNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsExpressionBasedNumericFormatWidgetBase
374{
375 Q_OBJECT
376
377 public:
378
384
386
387 void setFormat( QgsNumericFormat *format ) final;
388
390
391 private:
392 std::unique_ptr<QgsExpressionBasedNumericFormat> mFormat;
393 bool mBlockSignals = false;
394};
395#endif // QGSNUMERICFORMATWIDGET_H
QgsBasicNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsBasicNumericFormatWidget, initially showing the specified format.
~QgsBasicNumericFormatWidget() override
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
A numeric formatter which returns a simple text representation of a value.
QgsBearingNumericFormatDialog(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsBearingNumericFormatDialog, initially showing the specified format.
QgsBearingNumericFormat * format()
Returns the format defined by the current settings in the dialog.
A widget which allows control over the properties of a QgsBearingNumericFormat.
QgsBearingNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsBearingNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
~QgsBearingNumericFormatWidget() override
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
A numeric formatter which returns a text representation of a direction/bearing.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsCurrencyNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsCurrencyNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
~QgsCurrencyNumericFormatWidget() override
A numeric formatter which returns a text representation of a currency value.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
QgsExpressionBasedNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsExpressionBasedNumericFormatWidget, initially showing the specified format.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
A numeric formatter which uses a QgsExpression to calculate the text representation of a value.
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...
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
~QgsFractionNumericFormatWidget() override
QgsFractionNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsFractionNumericFormatWidget, initially showing the specified format.
A numeric formatter which returns a vulgar fractional representation of a decimal value (e....
QgsGeographicCoordinateNumericFormatDialog(const QgsNumericFormat *format, bool hidePrecisionControl=false, QWidget *parent=nullptr)
Constructor for QgsGeographicCoordinateNumericFormatDialog, initially showing the specified format.
QgsGeographicCoordinateNumericFormat * format()
Returns the format defined by the current settings in the dialog.
A widget which allows control over the properties of a QgsGeographicCoordinateNumericFormat.
QgsGeographicCoordinateNumericFormatWidget(const QgsNumericFormat *format, bool hidePrecisionControl=false, QWidget *parent=nullptr)
Constructor for QgsGeographicCoordinateNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
A numeric formatter which returns a text representation of a geographic coordinate (latitude or longi...
void registerExpressionContextGenerator(QgsExpressionContextGenerator *generator)
Register an expression context generator class that will be used to retrieve an expression context fo...
QgsNumericFormatWidget(QWidget *parent=nullptr)
Constructor for QgsNumericFormatWidget.
virtual void setFormat(QgsNumericFormat *format)=0
Sets the format to show in the widget.
void changed()
Emitted whenever the configuration of the numeric format is changed.
virtual QgsNumericFormat * format()=0
Returns the format defined by the current settings in the widget.
Abstract base class for numeric formatters, which allow for formatting a numeric value for display.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
QgsPercentageNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsPercentageNumericFormatWidget, initially showing the specified format.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
A numeric formatter which returns a text representation of a percentage value.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsScientificNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsScientificNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
A numeric formatter which returns a scientific notation representation of a value.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48
#define SIP_FACTORY
Definition qgis_sip.h:84