QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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"
21#include <memory>
22#include <QDialog>
23
25
32class GUI_EXPORT QgsNumericFormatWidget : public QgsPanelWidget
33{
34 Q_OBJECT
35
36 public:
37
41 QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr )
42 : QgsPanelWidget( parent )
43 {}
44
49 virtual void setFormat( QgsNumericFormat *format ) = 0;
50
59
60 signals:
61
65 void changed();
66
67};
68
69
70#include "ui_qgsbasicnumericformatwidgetbase.h"
71
73
80class GUI_EXPORT QgsBasicNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBasicNumericFormatWidgetBase
81{
82 Q_OBJECT
83
84 public:
85
89 QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
91
92 void setFormat( QgsNumericFormat *format ) override;
93
94 QgsNumericFormat *format() override SIP_FACTORY;
95
96 private:
97 std::unique_ptr< QgsBasicNumericFormat > mFormat;
98 bool mBlockSignals = false;
99
100};
101
102#include "ui_qgsbearingnumericformatwidgetbase.h"
103
105
112class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
113{
114 Q_OBJECT
115
116 public:
117
121 QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
123
124 void setFormat( QgsNumericFormat *format ) override;
125
126 QgsNumericFormat *format() override SIP_FACTORY;
127
128 private:
129 std::unique_ptr< QgsBearingNumericFormat > mFormat;
130 bool mBlockSignals = false;
131
132};
133
134
141class GUI_EXPORT QgsBearingNumericFormatDialog : public QDialog
142{
143 Q_OBJECT
144
145 public:
146
150 QgsBearingNumericFormatDialog( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
151
158
159 private:
160
161 QgsBearingNumericFormatWidget *mWidget = nullptr;
162};
163
164
165#include "ui_qgsgeographiccoordinatenumericformatwidgetbase.h"
166
168
175class GUI_EXPORT QgsGeographicCoordinateNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsGeographicCoordinateNumericFormatWidgetBase
176{
177 Q_OBJECT
178
179 public:
180
184 QgsGeographicCoordinateNumericFormatWidget( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
186
187 void setFormat( QgsNumericFormat *format ) override;
188
189 QgsNumericFormat *format() override SIP_FACTORY;
190
191 private:
193 bool mBlockSignals = false;
194
195};
196
197
204class GUI_EXPORT QgsGeographicCoordinateNumericFormatDialog : public QDialog
205{
206 Q_OBJECT
207
208 public:
209
213 QgsGeographicCoordinateNumericFormatDialog( const QgsNumericFormat *format, bool hidePrecisionControl = false, QWidget *parent SIP_TRANSFERTHIS = nullptr );
214
221
222 private:
223
225};
226
227
228
229#include "ui_qgscurrencynumericformatwidgetbase.h"
230
232
239class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
240{
241 Q_OBJECT
242
243 public:
244
248 QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
250
251 void setFormat( QgsNumericFormat *format ) override;
252
253 QgsNumericFormat *format() override SIP_FACTORY;
254
255 private:
256 std::unique_ptr< QgsCurrencyNumericFormat > mFormat;
257 bool mBlockSignals = false;
258
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:
277
281 QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
283
284 void setFormat( QgsNumericFormat *format ) override;
285
286 QgsNumericFormat *format() override SIP_FACTORY;
287
288 private:
290 bool mBlockSignals = false;
291
292};
293
294
295
296#include "ui_qgsscientificnumericformatwidgetbase.h"
297
299
306class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
307{
308 Q_OBJECT
309
310 public:
311
315 QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
317
318 void setFormat( QgsNumericFormat *format ) override;
319
320 QgsNumericFormat *format() override SIP_FACTORY;
321
322 private:
324 bool mBlockSignals = false;
325
326};
327
328
329#include "ui_qgsfractionnumericformatwidgetbase.h"
330
337class GUI_EXPORT QgsFractionNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsFractionNumericFormatWidgetBase
338{
339 Q_OBJECT
340
341 public:
342
346 QgsFractionNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
348
349 void setFormat( QgsNumericFormat *format ) override;
350
351 QgsNumericFormat *format() override SIP_FACTORY;
352
353 private:
354 std::unique_ptr< QgsFractionNumericFormat > mFormat;
355 bool mBlockSignals = false;
356
357};
358#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 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.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:73
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
#define SIP_FACTORY
Definition: qgis_sip.h:76