QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
32 class 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 
58  virtual QgsNumericFormat *format() = 0 SIP_TRANSFERBACK;
59 
60  signals:
61 
65  void changed();
66 
67 };
68 
69 
70 #include "ui_qgsbasicnumericformatwidgetbase.h"
71 
73 
80 class 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 );
90  ~QgsBasicNumericFormatWidget() override;
91 
92  void setFormat( QgsNumericFormat *format ) override;
93 
95 
96  private:
97  std::unique_ptr< QgsBasicNumericFormat > mFormat;
98  bool mBlockSignals = false;
99 
100 };
101 
102 #include "ui_qgsbearingnumericformatwidgetbase.h"
103 
105 
112 class 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 );
122  ~QgsBearingNumericFormatWidget() override;
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 
141 class 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 
175 class 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:
192  std::unique_ptr< QgsGeographicCoordinateNumericFormat > mFormat;
193  bool mBlockSignals = false;
194 
195 };
196 
197 
204 class 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 
239 class 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 );
249  ~QgsCurrencyNumericFormatWidget() override;
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 
272 class 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:
289  std::unique_ptr< QgsPercentageNumericFormat > mFormat;
290  bool mBlockSignals = false;
291 
292 };
293 
294 
295 
296 #include "ui_qgsscientificnumericformatwidgetbase.h"
297 
299 
306 class 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:
323  std::unique_ptr< QgsScientificNumericFormat > mFormat;
324  bool mBlockSignals = false;
325 
326 };
327 
328 
329 #include "ui_qgsfractionnumericformatwidgetbase.h"
330 
337 class 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 );
347  ~QgsFractionNumericFormatWidget() override;
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
QgsBearingNumericFormatDialog
A dialog which allow control over the properties of a QgsBearingNumericFormat.
Definition: qgsnumericformatwidget.h:141
QgsGeographicCoordinateNumericFormat
A numeric formatter which returns a text representation of a geographic coordinate (latitude or longi...
Definition: qgscoordinatenumericformat.h:28
QgsNumericFormatWidget::format
virtual QgsNumericFormat * format()=0
Returns the format defined by the current settings in the widget.
QgsNumericFormat
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
Definition: qgsnumericformat.h:259
QgsNumericFormatWidget
Base class for widgets which allow control over the properties of QgsNumericFormat subclasses.
Definition: qgsnumericformatwidget.h:32
QgsBasicNumericFormat
A numeric formatter which returns a simple text representation of a value.
Definition: qgsbasicnumericformat.h:31
QgsPercentageNumericFormatWidget
A widget which allow control over the properties of a QgsPercentageNumericFormat.
Definition: qgsnumericformatwidget.h:272
SIP_TRANSFERBACK
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPercentageNumericFormat
A numeric formatter which returns a text representation of a percentage value.
Definition: qgspercentagenumericformat.h:28
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsBasicNumericFormatWidget
A widget which allow control over the properties of a QgsBasicNumericFormat.
Definition: qgsnumericformatwidget.h:80
QgsNumericFormatWidget::setFormat
virtual void setFormat(QgsNumericFormat *format)=0
Sets the format to show in the widget.
QgsGeographicCoordinateNumericFormatWidget
A widget which allow control over the properties of a QgsGeographicCoordinateNumericFormat.
Definition: qgsnumericformatwidget.h:175
qgis_sip.h
QgsBearingNumericFormatWidget
A widget which allow control over the properties of a QgsBearingNumericFormat.
Definition: qgsnumericformatwidget.h:112
qgsnumericformat.h
QgsNumericFormatWidget::QgsNumericFormatWidget
QgsNumericFormatWidget(QWidget *parent=nullptr)
Constructor for QgsNumericFormatWidget.
Definition: qgsnumericformatwidget.h:41
QgsFractionNumericFormat
A numeric formatter which returns a vulgar fractional representation of a decimal value (e....
Definition: qgsfractionnumericformat.h:30
QgsScientificNumericFormat
A numeric formatter which returns a scientific notation representation of a value.
Definition: qgsscientificnumericformat.h:28
QgsFractionNumericFormatWidget
A widget which allow control over the properties of a QgsFractionNumericFormat.
Definition: qgsnumericformatwidget.h:337
QgsCurrencyNumericFormat
A numeric formatter which returns a text representation of a currency value.
Definition: qgscurrencynumericformat.h:28
QgsScientificNumericFormatWidget
A widget which allow control over the properties of a QgsScientificNumericFormat.
Definition: qgsnumericformatwidget.h:306
QgsGeographicCoordinateNumericFormatDialog
A dialog which allow control over the properties of a QgsGeographicCoordinateNumericFormat.
Definition: qgsnumericformatwidget.h:204
QgsBearingNumericFormat
A numeric formatter which returns a text representation of a direction/bearing.
Definition: qgsbearingnumericformat.h:28
qgspanelwidget.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsCurrencyNumericFormatWidget
A widget which allow control over the properties of a QgsCurrencyNumericFormat.
Definition: qgsnumericformatwidget.h:239