QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
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 
30 class GUI_EXPORT QgsNumericFormatWidget : public QgsPanelWidget
31 {
32  Q_OBJECT
33 
34  public:
35 
39  QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr )
40  : QgsPanelWidget( parent )
41  {}
42 
47  virtual void setFormat( QgsNumericFormat *format ) = 0;
48 
56  virtual QgsNumericFormat *format() = 0 SIP_TRANSFERBACK;
57 
58  signals:
59 
63  void changed();
64 
65 };
66 
67 
68 #include "ui_qgsbasicnumericformatwidgetbase.h"
69 
71 
78 class GUI_EXPORT QgsBasicNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBasicNumericFormatWidgetBase
79 {
80  Q_OBJECT
81 
82  public:
83 
87  QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
88  ~QgsBasicNumericFormatWidget() override;
89 
90  void setFormat( QgsNumericFormat *format ) override;
91 
93 
94  private:
95  std::unique_ptr< QgsBasicNumericFormat > mFormat;
96  bool mBlockSignals = false;
97 
98 };
99 
100 #include "ui_qgsbearingnumericformatwidgetbase.h"
101 
103 
110 class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
111 {
112  Q_OBJECT
113 
114  public:
115 
119  QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
120  ~QgsBearingNumericFormatWidget() override;
121 
122  void setFormat( QgsNumericFormat *format ) override;
123 
124  QgsNumericFormat *format() override SIP_FACTORY;
125 
126  private:
127  std::unique_ptr< QgsBearingNumericFormat > mFormat;
128  bool mBlockSignals = false;
129 
130 };
131 
132 
139 class GUI_EXPORT QgsBearingNumericFormatDialog : public QDialog
140 {
141  Q_OBJECT
142 
143  public:
144 
148  QgsBearingNumericFormatDialog( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
149 
156 
157  private:
158 
159  QgsBearingNumericFormatWidget *mWidget = nullptr;
160 };
161 
162 
163 
164 
165 #include "ui_qgscurrencynumericformatwidgetbase.h"
166 
168 
175 class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
176 {
177  Q_OBJECT
178 
179  public:
180 
184  QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
185  ~QgsCurrencyNumericFormatWidget() override;
186 
187  void setFormat( QgsNumericFormat *format ) override;
188 
189  QgsNumericFormat *format() override SIP_FACTORY;
190 
191  private:
192  std::unique_ptr< QgsCurrencyNumericFormat > mFormat;
193  bool mBlockSignals = false;
194 
195 };
196 
197 
198 #include "ui_qgspercentagenumericformatwidgetbase.h"
199 
201 
208 class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
209 {
210  Q_OBJECT
211 
212  public:
213 
217  QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
219 
220  void setFormat( QgsNumericFormat *format ) override;
221 
222  QgsNumericFormat *format() override SIP_FACTORY;
223 
224  private:
225  std::unique_ptr< QgsPercentageNumericFormat > mFormat;
226  bool mBlockSignals = false;
227 
228 };
229 
230 
231 
232 #include "ui_qgsscientificnumericformatwidgetbase.h"
233 
235 
242 class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
243 {
244  Q_OBJECT
245 
246  public:
247 
251  QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
253 
254  void setFormat( QgsNumericFormat *format ) override;
255 
256  QgsNumericFormat *format() override SIP_FACTORY;
257 
258  private:
259  std::unique_ptr< QgsScientificNumericFormat > mFormat;
260  bool mBlockSignals = false;
261 
262 };
263 
264 
265 #endif // QGSNUMERICFORMATWIDGET_H
A numeric formatter which returns a text representation of a percentage value.
virtual void setFormat(QgsNumericFormat *format)=0
Sets the format to show in the widget.
A widget which allow control over the properties of a QgsCurrencyNumericFormat.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
A widget which allow control over the properties of a QgsBearingNumericFormat.
Base class for widgets which allow control over the properties of QgsNumericFormat subclasses...
A numeric formatter which returns a scientific notation representation of a value.
QgsNumericFormatWidget(QWidget *parent=nullptr)
Constructor for QgsNumericFormatWidget.
A numeric formatter which returns a text representation of a direction/bearing.
A numeric formatter which returns a simple text representation of a value.
A widget which allow control over the properties of a QgsScientificNumericFormat. ...
Base class for any widget that can be shown as a inline panel.
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
A widget which allow control over the properties of a QgsBasicNumericFormat.
A widget which allow control over the properties of a QgsPercentageNumericFormat. ...
#define SIP_FACTORY
Definition: qgis_sip.h:76
A numeric formatter which returns a text representation of a currency value.
A dialog which allow control over the properties of a QgsBearingNumericFormat.
virtual QgsNumericFormat * format()=0
Returns the format defined by the current settings in the widget.