QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 "ui_qgsnumericformatselectorbase.h"
20
21#include <memory>
22
23#include "qgis_gui.h"
24#include "qgis_sip.h"
25#include "qgsguiutils.h"
26
27#include <QDialog>
28
32class QDialogButtonBox;
33
40class GUI_EXPORT QgsNumericFormatSelectorWidget : public QgsPanelWidget, private Ui::QgsNumericFormatSelectorBase
41{
42 Q_OBJECT
43
44 public:
48 QgsNumericFormatSelectorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
49
51
55 void setFormat( const QgsNumericFormat *format );
56
63
73
74 signals:
75
79 void changed();
80
81 private slots:
82 void formatTypeChanged();
83 void formatChanged();
84
85 private:
86 void populateTypes();
87 void updateFormatWidget();
88 void updateSampleText();
89
90 std::unique_ptr<QgsNumericFormat> mCurrentFormat;
91 std::unique_ptr<QgsBasicNumericFormat> mPreviewFormat;
92
93 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
94};
95
96
105class GUI_EXPORT QgsNumericFormatSelectorDialog : public QDialog
106{
107 Q_OBJECT
108
109 public:
115 QgsNumericFormatSelectorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = QgsGuiUtils::ModalDialogFlags );
116
120 void setFormat( const QgsNumericFormat *format );
121
128
136
137 private:
138 QgsNumericFormatSelectorWidget *mFormatWidget = nullptr;
139 QDialogButtonBox *mButtonBox = nullptr;
140};
141
142#endif //QGSNUMERICFORMATSELECTORWIDGET_H
A numeric formatter which returns a simple text representation of a value.
Abstract interface for generating an expression context.
QgsNumericFormat * format() const
Returns a new format object representing the settings currently configured in the dialog.
void setFormat(const QgsNumericFormat *format)
Sets the format to show in the dialog.
QgsNumericFormatSelectorDialog(QWidget *parent=nullptr, Qt::WindowFlags flags=QgsGuiUtils::ModalDialogFlags)
Constructor for QgsNumericFormatSelectorDialog.
void registerExpressionContextGenerator(QgsExpressionContextGenerator *generator)
Register an expression context generator class that will be used to retrieve an expression context fo...
A widget which allows choice of numeric formats and the properties of them.
QgsNumericFormat * format() const
Returns a new format object representing the settings currently configured in the widget.
~QgsNumericFormatSelectorWidget() override
void changed()
Emitted whenever the format configured55 in the widget is changed.
void registerExpressionContextGenerator(QgsExpressionContextGenerator *generator)
Register an expression context generator class that will be used to retrieve an expression context fo...
QgsNumericFormatSelectorWidget(QWidget *parent=nullptr)
Constructor for QgsNumericFormatSelectorWidget with the specified parent widget.
void setFormat(const QgsNumericFormat *format)
Sets the format to show in the widget.
Abstract base class for numeric formatters, which allow for formatting a numeric value for display.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48