QGIS API Documentation 4.3.0-Master (b46232e4f9a)
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 private:
74 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
75};
76
77
78#include "ui_qgsbasicnumericformatwidgetbase.h"
79
81
88class GUI_EXPORT QgsBasicNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBasicNumericFormatWidgetBase
89{
90 Q_OBJECT
91
92 public:
96 QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
98
99 void setFormat( QgsNumericFormat *format ) final;
100
102
103 private:
104 std::unique_ptr<QgsBasicNumericFormat> mFormat;
105 bool mBlockSignals = false;
106};
107
108#include "ui_qgsbearingnumericformatwidgetbase.h"
109
111
118class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
119{
120 Q_OBJECT
121
122 public:
126 QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
128
129 void setFormat( QgsNumericFormat *format ) final;
130
132
133 private:
134 std::unique_ptr<QgsBearingNumericFormat> mFormat;
135 bool mBlockSignals = false;
136};
137
138
145class GUI_EXPORT QgsBearingNumericFormatDialog : public QDialog
146{
147 Q_OBJECT
148
149 public:
153 QgsBearingNumericFormatDialog( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
154
161
162 private:
163 QgsBearingNumericFormatWidget *mWidget = nullptr;
164};
165
166
167#include "ui_qgsgeographiccoordinatenumericformatwidgetbase.h"
168
170
177class GUI_EXPORT QgsGeographicCoordinateNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsGeographicCoordinateNumericFormatWidgetBase
178{
179 Q_OBJECT
180
181 public:
185 QgsGeographicCoordinateNumericFormatWidget( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
187
188 void setFormat( QgsNumericFormat *format ) final;
189
191
192 private:
193 std::unique_ptr<QgsGeographicCoordinateNumericFormat> mFormat;
194 bool mBlockSignals = false;
195};
196
197
204class GUI_EXPORT QgsGeographicCoordinateNumericFormatDialog : public QDialog
205{
206 Q_OBJECT
207
208 public:
212 QgsGeographicCoordinateNumericFormatDialog( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
213
220
221 private:
223};
224
225
226#include "ui_qgscurrencynumericformatwidgetbase.h"
227
229
236class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
237{
238 Q_OBJECT
239
240 public:
244 QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
246
247 void setFormat( QgsNumericFormat *format ) final;
248
250
251 private:
252 std::unique_ptr<QgsCurrencyNumericFormat> mFormat;
253 bool mBlockSignals = false;
254};
255
256
257#include "ui_qgspercentagenumericformatwidgetbase.h"
258
260
267class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
268{
269 Q_OBJECT
270
271 public:
277
278 void setFormat( QgsNumericFormat *format ) final;
279
281
282 private:
283 std::unique_ptr<QgsPercentageNumericFormat> mFormat;
284 bool mBlockSignals = false;
285};
286
287
288#include "ui_qgsscientificnumericformatwidgetbase.h"
289
291
298class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
299{
300 Q_OBJECT
301
302 public:
308
309 void setFormat( QgsNumericFormat *format ) final;
310
312
313 private:
314 std::unique_ptr<QgsScientificNumericFormat> mFormat;
315 bool mBlockSignals = false;
316};
317
318
319#include "ui_qgsfractionnumericformatwidgetbase.h"
320
327class GUI_EXPORT QgsFractionNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsFractionNumericFormatWidgetBase
328{
329 Q_OBJECT
330
331 public:
335 QgsFractionNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
337
338 void setFormat( QgsNumericFormat *format ) final;
339
341
342 private:
343 std::unique_ptr<QgsFractionNumericFormat> mFormat;
344 bool mBlockSignals = false;
345};
346
347
348#include "ui_qgsexpressionbasednumericformatwidgetbase.h"
349
356class GUI_EXPORT QgsExpressionBasedNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsExpressionBasedNumericFormatWidgetBase
357{
358 Q_OBJECT
359
360 public:
366
368
369 void setFormat( QgsNumericFormat *format ) final;
370
372
373 private:
374 std::unique_ptr<QgsExpressionBasedNumericFormat> mFormat;
375 bool mBlockSignals = false;
376};
377#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.
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:52
#define SIP_TRANSFERBACK
Definition qgis_sip.h:47
#define SIP_FACTORY
Definition qgis_sip.h:83