QGIS API Documentation 3.41.0-Master (af5edcb665c)
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:
45 QgsNumericFormatSelectorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
46
48
52 void setFormat( const QgsNumericFormat *format );
53
59 QgsNumericFormat *format() const SIP_TRANSFERBACK;
60
69 void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
70
71 signals:
72
76 void changed();
77
78 private slots:
79 void formatTypeChanged();
80 void formatChanged();
81
82 private:
83 void populateTypes();
84 void updateFormatWidget();
85 void updateSampleText();
86
87 std::unique_ptr<QgsNumericFormat> mCurrentFormat;
88 std::unique_ptr<QgsBasicNumericFormat> mPreviewFormat;
89
90 QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
91};
92
93
102class GUI_EXPORT QgsNumericFormatSelectorDialog : public QDialog
103{
104 Q_OBJECT
105
106 public:
112 QgsNumericFormatSelectorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = QgsGuiUtils::ModalDialogFlags );
113
117 void setFormat( const QgsNumericFormat *format );
118
124 QgsNumericFormat *format() const SIP_TRANSFERBACK;
125
132 void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
133
134 private:
135 QgsNumericFormatSelectorWidget *mFormatWidget = nullptr;
136 QDialogButtonBox *mButtonBox = nullptr;
137};
138
139#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