QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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:
44 QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr )
45 : QgsPanelWidget( parent )
46 {}
47
52 virtual void setFormat( QgsNumericFormat *format ) = 0;
53
62
70
72
73 signals:
74
78 void changed();
79
80 private:
81 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
82};
83
84
85#include "ui_qgsbasicnumericformatwidgetbase.h"
86
88
95class GUI_EXPORT QgsBasicNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBasicNumericFormatWidgetBase
96{
97 Q_OBJECT
98
99 public:
103 QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
105
106 void setFormat( QgsNumericFormat *format ) final;
107
109
110 private:
111 std::unique_ptr<QgsBasicNumericFormat> mFormat;
112 bool mBlockSignals = false;
113};
114
115#include "ui_qgsbearingnumericformatwidgetbase.h"
116
118
125class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
126{
127 Q_OBJECT
128
129 public:
133 QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
135
136 void setFormat( QgsNumericFormat *format ) final;
137
139
140 private:
141 std::unique_ptr<QgsBearingNumericFormat> mFormat;
142 bool mBlockSignals = false;
143};
144
145
152class GUI_EXPORT QgsBearingNumericFormatDialog : public QDialog
153{
154 Q_OBJECT
155
156 public:
160 QgsBearingNumericFormatDialog( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
161
168
169 private:
170 QgsBearingNumericFormatWidget *mWidget = nullptr;
171};
172
173
174#include "ui_qgsgeographiccoordinatenumericformatwidgetbase.h"
175
177
184class GUI_EXPORT QgsGeographicCoordinateNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsGeographicCoordinateNumericFormatWidgetBase
185{
186 Q_OBJECT
187
188 public:
192 QgsGeographicCoordinateNumericFormatWidget( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
194
195 void setFormat( QgsNumericFormat *format ) final;
196
198
199 private:
200 std::unique_ptr<QgsGeographicCoordinateNumericFormat> mFormat;
201 bool mBlockSignals = false;
202};
203
204
211class GUI_EXPORT QgsGeographicCoordinateNumericFormatDialog : public QDialog
212{
213 Q_OBJECT
214
215 public:
219 QgsGeographicCoordinateNumericFormatDialog( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
220
227
228 private:
230};
231
232
233#include "ui_qgscurrencynumericformatwidgetbase.h"
234
236
243class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
244{
245 Q_OBJECT
246
247 public:
251 QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
253
254 void setFormat( QgsNumericFormat *format ) final;
255
257
258 private:
259 std::unique_ptr<QgsCurrencyNumericFormat> mFormat;
260 bool mBlockSignals = false;
261};
262
263
264#include "ui_qgspercentagenumericformatwidgetbase.h"
265
267
274class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
275{
276 Q_OBJECT
277
278 public:
284
285 void setFormat( QgsNumericFormat *format ) final;
286
288
289 private:
290 std::unique_ptr<QgsPercentageNumericFormat> mFormat;
291 bool mBlockSignals = false;
292};
293
294
295#include "ui_qgsscientificnumericformatwidgetbase.h"
296
298
305class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
306{
307 Q_OBJECT
308
309 public:
315
316 void setFormat( QgsNumericFormat *format ) final;
317
319
320 private:
321 std::unique_ptr<QgsScientificNumericFormat> mFormat;
322 bool mBlockSignals = false;
323};
324
325
326#include "ui_qgsfractionnumericformatwidgetbase.h"
327
334class GUI_EXPORT QgsFractionNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsFractionNumericFormatWidgetBase
335{
336 Q_OBJECT
337
338 public:
342 QgsFractionNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
344
345 void setFormat( QgsNumericFormat *format ) final;
346
348
349 private:
350 std::unique_ptr<QgsFractionNumericFormat> mFormat;
351 bool mBlockSignals = false;
352};
353
354
355#include "ui_qgsexpressionbasednumericformatwidgetbase.h"
356
363class GUI_EXPORT QgsExpressionBasedNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsExpressionBasedNumericFormatWidgetBase
364{
365 Q_OBJECT
366
367 public:
373
375
376 void setFormat( QgsNumericFormat *format ) final;
377
379
380 private:
381 std::unique_ptr<QgsExpressionBasedNumericFormat> mFormat;
382 bool mBlockSignals = false;
383};
384#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