QGIS API Documentation 3.41.0-Master (af5edcb665c)
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:
42 QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr )
43 : QgsPanelWidget( parent )
44 {}
45
50 virtual void setFormat( QgsNumericFormat *format ) = 0;
51
60
67 void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
68
70
71 signals:
72
76 void changed();
77
78 private:
79 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
80};
81
82
83#include "ui_qgsbasicnumericformatwidgetbase.h"
84
86
93class GUI_EXPORT QgsBasicNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBasicNumericFormatWidgetBase
94{
95 Q_OBJECT
96
97 public:
101 QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
103
104 void setFormat( QgsNumericFormat *format ) final;
105
106 QgsNumericFormat *format() final SIP_FACTORY;
107
108 private:
109 std::unique_ptr<QgsBasicNumericFormat> mFormat;
110 bool mBlockSignals = false;
111};
112
113#include "ui_qgsbearingnumericformatwidgetbase.h"
114
116
123class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
124{
125 Q_OBJECT
126
127 public:
131 QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
133
134 void setFormat( QgsNumericFormat *format ) final;
135
136 QgsNumericFormat *format() final SIP_FACTORY;
137
138 private:
139 std::unique_ptr<QgsBearingNumericFormat> mFormat;
140 bool mBlockSignals = false;
141};
142
143
150class GUI_EXPORT QgsBearingNumericFormatDialog : public QDialog
151{
152 Q_OBJECT
153
154 public:
158 QgsBearingNumericFormatDialog( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
159
166
167 private:
168 QgsBearingNumericFormatWidget *mWidget = nullptr;
169};
170
171
172#include "ui_qgsgeographiccoordinatenumericformatwidgetbase.h"
173
175
182class GUI_EXPORT QgsGeographicCoordinateNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsGeographicCoordinateNumericFormatWidgetBase
183{
184 Q_OBJECT
185
186 public:
190 QgsGeographicCoordinateNumericFormatWidget( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
192
193 void setFormat( QgsNumericFormat *format ) final;
194
195 QgsNumericFormat *format() final SIP_FACTORY;
196
197 private:
198 std::unique_ptr<QgsGeographicCoordinateNumericFormat> mFormat;
199 bool mBlockSignals = false;
200};
201
202
209class GUI_EXPORT QgsGeographicCoordinateNumericFormatDialog : public QDialog
210{
211 Q_OBJECT
212
213 public:
217 QgsGeographicCoordinateNumericFormatDialog( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
218
225
226 private:
228};
229
230
231#include "ui_qgscurrencynumericformatwidgetbase.h"
232
234
241class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
242{
243 Q_OBJECT
244
245 public:
249 QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
251
252 void setFormat( QgsNumericFormat *format ) final;
253
254 QgsNumericFormat *format() final SIP_FACTORY;
255
256 private:
257 std::unique_ptr<QgsCurrencyNumericFormat> mFormat;
258 bool mBlockSignals = false;
259};
260
261
262#include "ui_qgspercentagenumericformatwidgetbase.h"
263
265
272class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
273{
274 Q_OBJECT
275
276 public:
280 QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
282
283 void setFormat( QgsNumericFormat *format ) final;
284
285 QgsNumericFormat *format() final SIP_FACTORY;
286
287 private:
288 std::unique_ptr<QgsPercentageNumericFormat> mFormat;
289 bool mBlockSignals = false;
290};
291
292
293#include "ui_qgsscientificnumericformatwidgetbase.h"
294
296
303class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
304{
305 Q_OBJECT
306
307 public:
311 QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
313
314 void setFormat( QgsNumericFormat *format ) final;
315
316 QgsNumericFormat *format() final SIP_FACTORY;
317
318 private:
319 std::unique_ptr<QgsScientificNumericFormat> mFormat;
320 bool mBlockSignals = false;
321};
322
323
324#include "ui_qgsfractionnumericformatwidgetbase.h"
325
332class GUI_EXPORT QgsFractionNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsFractionNumericFormatWidgetBase
333{
334 Q_OBJECT
335
336 public:
340 QgsFractionNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
342
343 void setFormat( QgsNumericFormat *format ) final;
344
345 QgsNumericFormat *format() final SIP_FACTORY;
346
347 private:
348 std::unique_ptr<QgsFractionNumericFormat> mFormat;
349 bool mBlockSignals = false;
350};
351
352
353#include "ui_qgsexpressionbasednumericformatwidgetbase.h"
354
361class GUI_EXPORT QgsExpressionBasedNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsExpressionBasedNumericFormatWidgetBase
362{
363 Q_OBJECT
364
365 public:
369 QgsExpressionBasedNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
371
373
374 void setFormat( QgsNumericFormat *format ) final;
375
376 QgsNumericFormat *format() final SIP_FACTORY;
377
378 private:
379 std::unique_ptr<QgsExpressionBasedNumericFormat> mFormat;
380 bool mBlockSignals = false;
381};
382#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