QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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 "qgis_sip.h"
19#include "qgsnumericformat.h"
20#include "qgspanelwidget.h"
22#include <memory>
23#include <QDialog>
24
27
35{
36 Q_OBJECT
37
38 public:
39
43 QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr )
44 : QgsPanelWidget( parent )
45 {}
46
51 virtual void setFormat( QgsNumericFormat *format ) = 0;
52
61
68 void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
69
71
72 signals:
73
77 void changed();
78
79 private:
80
81 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
82
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
110 QgsNumericFormat *format() final SIP_FACTORY;
111
112 private:
113 std::unique_ptr< QgsBasicNumericFormat > mFormat;
114 bool mBlockSignals = false;
115
116};
117
118#include "ui_qgsbearingnumericformatwidgetbase.h"
119
121
128class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
129{
130 Q_OBJECT
131
132 public:
133
137 QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
139
140 void setFormat( QgsNumericFormat *format ) final;
141
142 QgsNumericFormat *format() final SIP_FACTORY;
143
144 private:
145 std::unique_ptr< QgsBearingNumericFormat > mFormat;
146 bool mBlockSignals = false;
147
148};
149
150
157class GUI_EXPORT QgsBearingNumericFormatDialog : public QDialog
158{
159 Q_OBJECT
160
161 public:
162
166 QgsBearingNumericFormatDialog( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
167
174
175 private:
176
177 QgsBearingNumericFormatWidget *mWidget = nullptr;
178};
179
180
181#include "ui_qgsgeographiccoordinatenumericformatwidgetbase.h"
182
184
191class GUI_EXPORT QgsGeographicCoordinateNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsGeographicCoordinateNumericFormatWidgetBase
192{
193 Q_OBJECT
194
195 public:
196
200 QgsGeographicCoordinateNumericFormatWidget( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
202
203 void setFormat( QgsNumericFormat *format ) final;
204
205 QgsNumericFormat *format() final SIP_FACTORY;
206
207 private:
208 std::unique_ptr< QgsGeographicCoordinateNumericFormat > mFormat;
209 bool mBlockSignals = false;
210
211};
212
213
220class GUI_EXPORT QgsGeographicCoordinateNumericFormatDialog : public QDialog
221{
222 Q_OBJECT
223
224 public:
225
229 QgsGeographicCoordinateNumericFormatDialog( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
230
237
238 private:
239
241};
242
243
244
245#include "ui_qgscurrencynumericformatwidgetbase.h"
246
248
255class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
256{
257 Q_OBJECT
258
259 public:
260
264 QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
266
267 void setFormat( QgsNumericFormat *format ) final;
268
269 QgsNumericFormat *format() final SIP_FACTORY;
270
271 private:
272 std::unique_ptr< QgsCurrencyNumericFormat > mFormat;
273 bool mBlockSignals = false;
274
275};
276
277
278#include "ui_qgspercentagenumericformatwidgetbase.h"
279
281
288class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
289{
290 Q_OBJECT
291
292 public:
293
297 QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
299
300 void setFormat( QgsNumericFormat *format ) final;
301
302 QgsNumericFormat *format() final SIP_FACTORY;
303
304 private:
305 std::unique_ptr< QgsPercentageNumericFormat > mFormat;
306 bool mBlockSignals = false;
307
308};
309
310
311
312#include "ui_qgsscientificnumericformatwidgetbase.h"
313
315
322class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
323{
324 Q_OBJECT
325
326 public:
327
331 QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
333
334 void setFormat( QgsNumericFormat *format ) final;
335
336 QgsNumericFormat *format() final SIP_FACTORY;
337
338 private:
339 std::unique_ptr< QgsScientificNumericFormat > mFormat;
340 bool mBlockSignals = false;
341
342};
343
344
345#include "ui_qgsfractionnumericformatwidgetbase.h"
346
353class GUI_EXPORT QgsFractionNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsFractionNumericFormatWidgetBase
354{
355 Q_OBJECT
356
357 public:
358
362 QgsFractionNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
364
365 void setFormat( QgsNumericFormat *format ) final;
366
367 QgsNumericFormat *format() final SIP_FACTORY;
368
369 private:
370 std::unique_ptr< QgsFractionNumericFormat > mFormat;
371 bool mBlockSignals = false;
372
373};
374
375
376#include "ui_qgsexpressionbasednumericformatwidgetbase.h"
377
384class GUI_EXPORT QgsExpressionBasedNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsExpressionBasedNumericFormatWidgetBase
385{
386 Q_OBJECT
387
388 public:
389
393 QgsExpressionBasedNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
395
397
398 void setFormat( QgsNumericFormat *format ) final;
399
400 QgsNumericFormat *format() final SIP_FACTORY;
401
402 private:
403 std::unique_ptr< QgsExpressionBasedNumericFormat > mFormat;
404 bool mBlockSignals = false;
405
406};
407#endif // QGSNUMERICFORMATWIDGET_H
A widget which allow control over the properties of a QgsBasicNumericFormat.
~QgsBasicNumericFormatWidget() override
A numeric formatter which returns a simple text representation of a value.
A dialog which allow control over the properties of a QgsBearingNumericFormat.
A widget which allow control over the properties of a QgsBearingNumericFormat.
~QgsBearingNumericFormatWidget() override
A numeric formatter which returns a text representation of a direction/bearing.
A widget which allow control over the properties of a QgsCurrencyNumericFormat.
~QgsCurrencyNumericFormatWidget() override
A numeric formatter which returns a text representation of a currency value.
A widget which allow control over the properties of a QgsExpressionBasedNumericFormat.
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...
A widget which allow control over the properties of a QgsFractionNumericFormat.
~QgsFractionNumericFormatWidget() override
A numeric formatter which returns a vulgar fractional representation of a decimal value (e....
A dialog which allow control over the properties of a QgsGeographicCoordinateNumericFormat.
A widget which allow control over the properties of a QgsGeographicCoordinateNumericFormat.
A numeric formatter which returns a text representation of a geographic coordinate (latitude or longi...
Base class for widgets which allow control over the properties of QgsNumericFormat subclasses.
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.
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
Base class for any widget that can be shown as a inline panel.
A widget which allow control over the properties of a QgsPercentageNumericFormat.
A numeric formatter which returns a text representation of a percentage value.
A widget which allow control over the properties of a QgsScientificNumericFormat.
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:76