QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
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 );
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 );
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 
166 
167 #include "ui_qgscurrencynumericformatwidgetbase.h"
168 
170 
177 class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
178 {
179  Q_OBJECT
180 
181  public:
182 
186  QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
188 
189  void setFormat( QgsNumericFormat *format ) override;
190 
191  QgsNumericFormat *format() override SIP_FACTORY;
192 
193  private:
194  std::unique_ptr< QgsCurrencyNumericFormat > mFormat;
195  bool mBlockSignals = false;
196 
197 };
198 
199 
200 #include "ui_qgspercentagenumericformatwidgetbase.h"
201 
203 
210 class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
211 {
212  Q_OBJECT
213 
214  public:
215 
219  QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
221 
222  void setFormat( QgsNumericFormat *format ) override;
223 
224  QgsNumericFormat *format() override SIP_FACTORY;
225 
226  private:
227  std::unique_ptr< QgsPercentageNumericFormat > mFormat;
228  bool mBlockSignals = false;
229 
230 };
231 
232 
233 
234 #include "ui_qgsscientificnumericformatwidgetbase.h"
235 
237 
244 class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
245 {
246  Q_OBJECT
247 
248  public:
249 
253  QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
255 
256  void setFormat( QgsNumericFormat *format ) override;
257 
258  QgsNumericFormat *format() override SIP_FACTORY;
259 
260  private:
261  std::unique_ptr< QgsScientificNumericFormat > mFormat;
262  bool mBlockSignals = false;
263 
264 };
265 
266 
267 #include "ui_qgsfractionnumericformatwidgetbase.h"
268 
275 class GUI_EXPORT QgsFractionNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsFractionNumericFormatWidgetBase
276 {
277  Q_OBJECT
278 
279  public:
280 
284  QgsFractionNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
286 
287  void setFormat( QgsNumericFormat *format ) override;
288 
289  QgsNumericFormat *format() override SIP_FACTORY;
290 
291  private:
292  std::unique_ptr< QgsFractionNumericFormat > mFormat;
293  bool mBlockSignals = false;
294 
295 };
296 #endif // QGSNUMERICFORMATWIDGET_H
QgsBearingNumericFormatDialog
A dialog which allow control over the properties of a QgsBearingNumericFormat.
Definition: qgsnumericformatwidget.h:142
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:218
QgsPercentageNumericFormatWidget::~QgsPercentageNumericFormatWidget
~QgsPercentageNumericFormatWidget() override
QgsNumericFormatWidget
Base class for widgets which allow control over the properties of QgsNumericFormat subclasses.
Definition: qgsnumericformatwidget.h:33
QgsBasicNumericFormat
A numeric formatter which returns a simple text representation of a value.
Definition: qgsbasicnumericformat.h:32
QgsPercentageNumericFormatWidget
A widget which allow control over the properties of a QgsPercentageNumericFormat.
Definition: qgsnumericformatwidget.h:211
SIP_TRANSFERBACK
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
geos::unique_ptr
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
QgsPercentageNumericFormat
A numeric formatter which returns a text representation of a percentage value.
Definition: qgspercentagenumericformat.h:29
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:30
QgsBasicNumericFormatWidget
A widget which allow control over the properties of a QgsBasicNumericFormat.
Definition: qgsnumericformatwidget.h:81
QgsNumericFormatWidget::setFormat
virtual void setFormat(QgsNumericFormat *format)=0
Sets the format to show in the widget.
QgsCurrencyNumericFormatWidget::~QgsCurrencyNumericFormatWidget
~QgsCurrencyNumericFormatWidget() override
QgsBearingNumericFormatWidget::~QgsBearingNumericFormatWidget
~QgsBearingNumericFormatWidget() override
qgis_sip.h
QgsBearingNumericFormatWidget
A widget which allow control over the properties of a QgsBearingNumericFormat.
Definition: qgsnumericformatwidget.h:113
QgsBasicNumericFormatWidget::~QgsBasicNumericFormatWidget
~QgsBasicNumericFormatWidget() override
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:31
QgsScientificNumericFormat
A numeric formatter which returns a scientific notation representation of a value.
Definition: qgsscientificnumericformat.h:29
QgsFractionNumericFormatWidget
A widget which allow control over the properties of a QgsFractionNumericFormat.
Definition: qgsnumericformatwidget.h:276
QgsNumericFormatWidget::changed
void changed()
Emitted whenever the configuration of the numeric format is changed.
QgsCurrencyNumericFormat
A numeric formatter which returns a text representation of a currency value.
Definition: qgscurrencynumericformat.h:29
QgsScientificNumericFormatWidget
A widget which allow control over the properties of a QgsScientificNumericFormat.
Definition: qgsnumericformatwidget.h:245
QgsScientificNumericFormatWidget::~QgsScientificNumericFormatWidget
~QgsScientificNumericFormatWidget() override
QgsBearingNumericFormat
A numeric formatter which returns a text representation of a direction/bearing.
Definition: qgsbearingnumericformat.h:29
qgspanelwidget.h
QgsFractionNumericFormatWidget::~QgsFractionNumericFormatWidget
~QgsFractionNumericFormatWidget() override
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:178