QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
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 );
187  ~QgsCurrencyNumericFormatWidget() override;
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 );
285  ~QgsFractionNumericFormatWidget() override;
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
Definition: qgsnumericformatwidget.h:141
QgsNumericFormatWidget::format
virtual QgsNumericFormat * format()=0
Returns the format defined by the current settings in the widget.
QgsNumericFormat
Definition: qgsnumericformat.h:217
QgsNumericFormatWidget
Definition: qgsnumericformatwidget.h:32
QgsBasicNumericFormat
Definition: qgsbasicnumericformat.h:31
QgsPercentageNumericFormatWidget
Definition: qgsnumericformatwidget.h:210
SIP_TRANSFERBACK
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPercentageNumericFormat
Definition: qgspercentagenumericformat.h:28
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsBasicNumericFormatWidget
Definition: qgsnumericformatwidget.h:80
QgsNumericFormatWidget::setFormat
virtual void setFormat(QgsNumericFormat *format)=0
Sets the format to show in the widget.
qgis_sip.h
QgsBearingNumericFormatWidget
Definition: qgsnumericformatwidget.h:112
qgsnumericformat.h
QgsNumericFormatWidget::QgsNumericFormatWidget
QgsNumericFormatWidget(QWidget *parent=nullptr)
Constructor for QgsNumericFormatWidget.
Definition: qgsnumericformatwidget.h:41
QgsFractionNumericFormat
Definition: qgsfractionnumericformat.h:30
QgsScientificNumericFormat
Definition: qgsscientificnumericformat.h:28
QgsFractionNumericFormatWidget
Definition: qgsnumericformatwidget.h:275
QgsCurrencyNumericFormat
Definition: qgscurrencynumericformat.h:28
QgsScientificNumericFormatWidget
Definition: qgsnumericformatwidget.h:244
QgsBearingNumericFormat
Definition: qgsbearingnumericformat.h:28
qgspanelwidget.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsCurrencyNumericFormatWidget
Definition: qgsnumericformatwidget.h:177