QGIS API Documentation 4.3.0-Master (3b7b3208a79)
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 private slots:
75 void formatTypeChanged();
76 void formatChanged();
77
78 private:
79 void populateTypes();
80 void updateFormatWidget();
81 void updateSampleText();
82
83 std::unique_ptr<QgsNumericFormat> mCurrentFormat;
84 std::unique_ptr<QgsBasicNumericFormat> mPreviewFormat;
85
86 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
87};
88
89
98class GUI_EXPORT QgsNumericFormatSelectorDialog : public QDialog
99{
100 Q_OBJECT
101
102 public:
108 QgsNumericFormatSelectorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = QgsGuiUtils::ModalDialogFlags );
109
113 void setFormat( const QgsNumericFormat *format );
114
121
129
130 private:
131 QgsNumericFormatSelectorWidget *mFormatWidget = nullptr;
132 QDialogButtonBox *mButtonBox = nullptr;
133};
134
135#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 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:52
#define SIP_TRANSFERBACK
Definition qgis_sip.h:47