QGIS API Documentation 3.39.0-Master (d85f3c2a281)
Loading...
Searching...
No Matches
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 "qgsguiutils.h"
22#include "ui_qgsnumericformatselectorbase.h"
23#include <memory>
24#include <QDialog>
25
29class QDialogButtonBox;
30
37class GUI_EXPORT QgsNumericFormatSelectorWidget : public QgsPanelWidget, private Ui::QgsNumericFormatSelectorBase
38{
39 Q_OBJECT
40
41 public:
42
46 QgsNumericFormatSelectorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
47
49
53 void setFormat( const QgsNumericFormat *format );
54
60 QgsNumericFormat *format() const SIP_TRANSFERBACK;
61
70 void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
71
72 signals:
73
77 void changed();
78
79 private slots:
80 void formatTypeChanged();
81 void formatChanged();
82
83 private:
84
85 void populateTypes();
86 void updateFormatWidget();
87 void updateSampleText();
88
89 std::unique_ptr< QgsNumericFormat > mCurrentFormat;
90 std::unique_ptr< QgsBasicNumericFormat > mPreviewFormat;
91
92 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
93};
94
95
104class GUI_EXPORT QgsNumericFormatSelectorDialog : public QDialog
105{
106 Q_OBJECT
107
108 public:
109
115 QgsNumericFormatSelectorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = QgsGuiUtils::ModalDialogFlags );
116
120 void setFormat( const QgsNumericFormat *format );
121
127 QgsNumericFormat *format() const SIP_TRANSFERBACK;
128
135 void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
136
137 private:
138
139 QgsNumericFormatSelectorWidget *mFormatWidget = nullptr;
140 QDialogButtonBox *mButtonBox = nullptr;
141
142};
143
144#endif //QGSNUMERICFORMATSELECTORWIDGET_H
A numeric formatter which returns a simple text representation of a value.
Abstract interface for generating an expression context.
A simple dialog for customizing a numeric format.
A widget which allows choice of numeric formats and the properties of them.
~QgsNumericFormatSelectorWidget() override
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.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48