QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
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 
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 
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
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....
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:79
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
#define SIP_FACTORY
Definition: qgis_sip.h:76