QGIS API Documentation  3.17.0-Master (df2c9ff931)
qgsnumericformatselectorwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsnumericformatselectorwidget.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 
16 #ifndef QGSNUMERICFORMATSELECTORWIDGET_H
17 #define QGSNUMERICFORMATSELECTORWIDGET_H
18 
19 #include "qgis_gui.h"
20 #include "qgis_sip.h"
21 #include "ui_qgsnumericformatselectorbase.h"
22 #include <memory>
23 
24 class QgsNumericFormat;
26 
27 
34 class GUI_EXPORT QgsNumericFormatSelectorWidget : public QgsPanelWidget, private Ui::QgsNumericFormatSelectorBase
35 {
36  Q_OBJECT
37 
38  public:
39 
43  QgsNumericFormatSelectorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
44 
46 
50  void setFormat( const QgsNumericFormat *format );
51 
57  QgsNumericFormat *format() const SIP_TRANSFERBACK;
58 
59  signals:
60 
64  void changed();
65 
66  private slots:
67  void formatTypeChanged();
68  void formatChanged();
69 
70  private:
71 
72  void populateTypes();
73  void updateFormatWidget();
74  void updateSampleText();
75 
76  std::unique_ptr< QgsNumericFormat > mCurrentFormat;
77  std::unique_ptr< QgsBasicNumericFormat > mPreviewFormat;
78 };
79 
80 #endif //QGSNUMERICFORMATSELECTORWIDGET_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
A numeric formatter which returns a simple text representation of a value.
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 allows choice of numeric formats and the properties of them.