Skip to content

Commit f5e965a

Browse files
committedJan 8, 2020
Add configuration widgets for all numeric format types
1 parent 1d6bc57 commit f5e965a

10 files changed

+1010
-4
lines changed
 

‎python/gui/auto_generated/numericformats/qgsnumericformatwidget.sip.in

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Base class for widgets which allow control over the properties of QgsNumericForm
2020
%End
2121
public:
2222

23-
QgsNumericFormatWidget( QWidget *parent /TransferThis/ );
23+
QgsNumericFormatWidget( QWidget *parent /TransferThis/ = 0 );
2424
%Docstring
2525
Constructor for QgsNumericFormatWidget.
2626
%End
@@ -51,6 +51,116 @@ Emitted whenever the configuration of the numeric format is changed.
5151
};
5252

5353

54+
55+
56+
class QgsBasicNumericFormatWidget : QgsNumericFormatWidget
57+
{
58+
59+
%TypeHeaderCode
60+
#include "qgsnumericformatwidget.h"
61+
%End
62+
public:
63+
64+
QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
65+
~QgsBasicNumericFormatWidget();
66+
67+
virtual void setFormat( QgsNumericFormat *format );
68+
69+
70+
virtual QgsNumericFormat *format() /Factory/;
71+
72+
73+
};
74+
75+
76+
77+
class QgsBearingNumericFormatWidget : QgsNumericFormatWidget
78+
{
79+
80+
%TypeHeaderCode
81+
#include "qgsnumericformatwidget.h"
82+
%End
83+
public:
84+
85+
QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
86+
~QgsBearingNumericFormatWidget();
87+
88+
virtual void setFormat( QgsNumericFormat *format );
89+
90+
91+
virtual QgsNumericFormat *format() /Factory/;
92+
93+
94+
};
95+
96+
97+
98+
99+
class QgsCurrencyNumericFormatWidget : QgsNumericFormatWidget
100+
{
101+
102+
%TypeHeaderCode
103+
#include "qgsnumericformatwidget.h"
104+
%End
105+
public:
106+
107+
QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
108+
~QgsCurrencyNumericFormatWidget();
109+
110+
virtual void setFormat( QgsNumericFormat *format );
111+
112+
113+
virtual QgsNumericFormat *format() /Factory/;
114+
115+
116+
};
117+
118+
119+
120+
121+
class QgsPercentageNumericFormatWidget : QgsNumericFormatWidget
122+
{
123+
124+
%TypeHeaderCode
125+
#include "qgsnumericformatwidget.h"
126+
%End
127+
public:
128+
129+
QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
130+
~QgsPercentageNumericFormatWidget();
131+
132+
virtual void setFormat( QgsNumericFormat *format );
133+
134+
135+
virtual QgsNumericFormat *format() /Factory/;
136+
137+
138+
};
139+
140+
141+
142+
143+
144+
class QgsScientificNumericFormatWidget : QgsNumericFormatWidget
145+
{
146+
147+
%TypeHeaderCode
148+
#include "qgsnumericformatwidget.h"
149+
%End
150+
public:
151+
152+
QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
153+
~QgsScientificNumericFormatWidget();
154+
155+
virtual void setFormat( QgsNumericFormat *format );
156+
157+
158+
virtual QgsNumericFormat *format() /Factory/;
159+
160+
161+
};
162+
163+
54164
/************************************************************************
55165
* This file has been generated automatically from *
56166
* *

‎src/core/numericformats/qgscurrencynumericformat.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
QgsCurrencyNumericFormat::QgsCurrencyNumericFormat()
2222
: mPrefix( QStringLiteral( "$" ) )
2323
{
24+
setNumberDecimalPlaces( 2 );
2425
}
2526

2627
QString QgsCurrencyNumericFormat::id() const
@@ -58,6 +59,10 @@ QgsNumericFormat *QgsCurrencyNumericFormat::create( const QVariantMap &configura
5859
res->setConfiguration( configuration, context );
5960
res->mPrefix = configuration.value( QStringLiteral( "prefix" ), QStringLiteral( "$" ) ).toString();
6061
res->mSuffix = configuration.value( QStringLiteral( "suffix" ), QString() ).toString();
62+
63+
// override base class default for number of decimal places -- we want to default to 2
64+
res->setNumberDecimalPlaces( configuration.value( QStringLiteral( "decimals" ), 2 ).toInt() );
65+
6166
return res.release();
6267
}
6368

‎src/gui/numericformats/qgsnumericformatguiregistry.cpp

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,65 @@
1919
#include "qgis.h"
2020
#include "qgsnumericformatwidget.h"
2121

22+
23+
class QgsBasicNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
24+
{
25+
public:
26+
27+
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
28+
{
29+
return new QgsBasicNumericFormatWidget( format );
30+
}
31+
};
32+
33+
class QgsBearingNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
34+
{
35+
public:
36+
37+
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
38+
{
39+
return new QgsBearingNumericFormatWidget( format );
40+
}
41+
};
42+
43+
class QgsCurrencyNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
44+
{
45+
public:
46+
47+
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
48+
{
49+
return new QgsCurrencyNumericFormatWidget( format );
50+
}
51+
};
52+
53+
class QgsPercentageNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
54+
{
55+
public:
56+
57+
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
58+
{
59+
return new QgsPercentageNumericFormatWidget( format );
60+
}
61+
};
62+
63+
class QgsScientificNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
64+
{
65+
public:
66+
67+
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
68+
{
69+
return new QgsScientificNumericFormatWidget( format );
70+
}
71+
};
72+
73+
2274
QgsNumericFormatGuiRegistry::QgsNumericFormatGuiRegistry()
2375
{
24-
// addFormatConfigurationWidgetFactory( new QgsFilterAlgorithmConfigurationWidgetFactory() );
76+
addFormatConfigurationWidgetFactory( QStringLiteral( "basic" ), new QgsBasicNumericFormatConfigurationWidgetFactory() );
77+
addFormatConfigurationWidgetFactory( QStringLiteral( "bearing" ), new QgsBearingNumericFormatConfigurationWidgetFactory() );
78+
addFormatConfigurationWidgetFactory( QStringLiteral( "currency" ), new QgsCurrencyNumericFormatConfigurationWidgetFactory() );
79+
addFormatConfigurationWidgetFactory( QStringLiteral( "percentage" ), new QgsPercentageNumericFormatConfigurationWidgetFactory() );
80+
addFormatConfigurationWidgetFactory( QStringLiteral( "scientific" ), new QgsScientificNumericFormatConfigurationWidgetFactory() );
2581
}
2682

2783
QgsNumericFormatGuiRegistry::~QgsNumericFormatGuiRegistry()

‎src/gui/numericformats/qgsnumericformatwidget.cpp

Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,301 @@
1414
***************************************************************************/
1515

1616
#include "qgsnumericformatwidget.h"
17+
#include "qgsbasicnumericformat.h"
18+
#include "qgscurrencynumericformat.h"
19+
#include "qgspercentagenumericformat.h"
20+
#include "qgsbearingnumericformat.h"
21+
#include "qgsscientificnumericformat.h"
22+
#include "qgis.h"
23+
24+
//
25+
// QgsBasicNumericFormatWidget
26+
//
27+
QgsBasicNumericFormatWidget::QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
28+
: QgsNumericFormatWidget( parent )
29+
{
30+
setupUi( this );
31+
setFormat( format->clone() );
32+
33+
connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
34+
{
35+
mFormat->setShowPlusSign( checked );
36+
if ( !mBlockSignals )
37+
emit changed();
38+
} );
39+
40+
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
41+
{
42+
mFormat->setShowTrailingZeros( checked );
43+
if ( !mBlockSignals )
44+
emit changed();
45+
} );
46+
47+
connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
48+
{
49+
mFormat->setShowThousandsSeparator( checked );
50+
if ( !mBlockSignals )
51+
emit changed();
52+
} );
53+
54+
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
55+
{
56+
mFormat->setNumberDecimalPlaces( value );
57+
if ( !mBlockSignals )
58+
emit changed();
59+
} );
60+
}
61+
62+
QgsBasicNumericFormatWidget::~QgsBasicNumericFormatWidget() = default;
63+
64+
void QgsBasicNumericFormatWidget::setFormat( QgsNumericFormat *format )
65+
{
66+
mFormat.reset( static_cast< QgsBasicNumericFormat * >( format ) );
67+
68+
mBlockSignals = true;
69+
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
70+
mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
71+
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
72+
mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
73+
mBlockSignals = false;
74+
}
75+
76+
QgsNumericFormat *QgsBasicNumericFormatWidget::format()
77+
{
78+
return mFormat->clone();
79+
}
80+
81+
//
82+
// QgsBearingNumericFormatWidget
83+
//
84+
85+
QgsBearingNumericFormatWidget::QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
86+
: QgsNumericFormatWidget( parent )
87+
{
88+
setupUi( this );
89+
90+
mFormatComboBox->addItem( QObject::tr( "0 to 180°, with E/W suffix" ), QgsBearingNumericFormat::UseRange0To180WithEWDirectionalSuffix );
91+
mFormatComboBox->addItem( QObject::tr( "-180 to +180°" ), QgsBearingNumericFormat::UseRangeNegative180ToPositive180 );
92+
mFormatComboBox->addItem( QObject::tr( "0 to 360°" ), QgsBearingNumericFormat::UseRange0To360 );
93+
94+
setFormat( format->clone() );
95+
96+
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
97+
{
98+
mFormat->setShowTrailingZeros( checked );
99+
if ( !mBlockSignals )
100+
emit changed();
101+
} );
102+
103+
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
104+
{
105+
mFormat->setNumberDecimalPlaces( value );
106+
if ( !mBlockSignals )
107+
emit changed();
108+
} );
109+
110+
connect( mFormatComboBox, qgis::overload<int>::of( &QComboBox::currentIndexChanged ), this, [ = ]( int )
111+
{
112+
mFormat->setDirectionFormat( static_cast < QgsBearingNumericFormat::FormatDirectionOption >( mFormatComboBox->currentData().toInt() ) );
113+
if ( !mBlockSignals )
114+
emit changed();
115+
} );
116+
}
117+
118+
QgsBearingNumericFormatWidget::~QgsBearingNumericFormatWidget() = default;
119+
120+
void QgsBearingNumericFormatWidget::setFormat( QgsNumericFormat *format )
121+
{
122+
mFormat.reset( static_cast< QgsBearingNumericFormat * >( format ) );
123+
124+
mBlockSignals = true;
125+
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
126+
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
127+
mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( static_cast< int >( mFormat->directionFormat() ) ) );
128+
mBlockSignals = false;
129+
}
130+
131+
QgsNumericFormat *QgsBearingNumericFormatWidget::format()
132+
{
133+
return mFormat->clone();
134+
}
135+
136+
137+
//
138+
// QgsCurrencyNumericFormatWidget
139+
//
140+
QgsCurrencyNumericFormatWidget::QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
141+
: QgsNumericFormatWidget( parent )
142+
{
143+
setupUi( this );
144+
setFormat( format->clone() );
145+
146+
connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
147+
{
148+
mFormat->setShowPlusSign( checked );
149+
if ( !mBlockSignals )
150+
emit changed();
151+
} );
152+
153+
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
154+
{
155+
mFormat->setShowTrailingZeros( checked );
156+
if ( !mBlockSignals )
157+
emit changed();
158+
} );
159+
160+
connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
161+
{
162+
mFormat->setShowThousandsSeparator( checked );
163+
if ( !mBlockSignals )
164+
emit changed();
165+
} );
166+
167+
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
168+
{
169+
mFormat->setNumberDecimalPlaces( value );
170+
if ( !mBlockSignals )
171+
emit changed();
172+
} );
173+
174+
connect( mPrefixLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
175+
{
176+
mFormat->setPrefix( text );
177+
if ( !mBlockSignals )
178+
emit changed();
179+
} );
180+
181+
connect( mSuffixLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
182+
{
183+
mFormat->setSuffix( text );
184+
if ( !mBlockSignals )
185+
emit changed();
186+
} );
187+
}
188+
189+
QgsCurrencyNumericFormatWidget::~QgsCurrencyNumericFormatWidget() = default;
190+
191+
void QgsCurrencyNumericFormatWidget::setFormat( QgsNumericFormat *format )
192+
{
193+
mFormat.reset( static_cast< QgsCurrencyNumericFormat * >( format ) );
194+
195+
mBlockSignals = true;
196+
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
197+
mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
198+
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
199+
mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
200+
mPrefixLineEdit->setText( mFormat->prefix() );
201+
mSuffixLineEdit->setText( mFormat->suffix() );
202+
203+
mBlockSignals = false;
204+
}
205+
206+
QgsNumericFormat *QgsCurrencyNumericFormatWidget::format()
207+
{
208+
return mFormat->clone();
209+
}
210+
211+
212+
//
213+
// QgsPercentageNumericFormatWidget
214+
//
215+
216+
QgsPercentageNumericFormatWidget::QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
217+
: QgsNumericFormatWidget( parent )
218+
{
219+
setupUi( this );
220+
221+
mScalingComboBox->addItem( QObject::tr( "Values are Percentages (e.g. 50)" ), QgsPercentageNumericFormat::ValuesArePercentage );
222+
mScalingComboBox->addItem( QObject::tr( "Values are Fractions (e.g. 0.5)" ), QgsPercentageNumericFormat::ValuesAreFractions );
223+
224+
setFormat( format->clone() );
225+
226+
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
227+
{
228+
mFormat->setShowTrailingZeros( checked );
229+
if ( !mBlockSignals )
230+
emit changed();
231+
} );
232+
233+
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
234+
{
235+
mFormat->setNumberDecimalPlaces( value );
236+
if ( !mBlockSignals )
237+
emit changed();
238+
} );
239+
240+
connect( mScalingComboBox, qgis::overload<int>::of( &QComboBox::currentIndexChanged ), this, [ = ]( int )
241+
{
242+
mFormat->setInputValues( static_cast < QgsPercentageNumericFormat::InputValues >( mScalingComboBox->currentData().toInt() ) );
243+
if ( !mBlockSignals )
244+
emit changed();
245+
} );
246+
}
247+
248+
QgsPercentageNumericFormatWidget::~QgsPercentageNumericFormatWidget() = default;
249+
250+
void QgsPercentageNumericFormatWidget::setFormat( QgsNumericFormat *format )
251+
{
252+
mFormat.reset( static_cast< QgsPercentageNumericFormat * >( format ) );
253+
254+
mBlockSignals = true;
255+
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
256+
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
257+
mScalingComboBox->setCurrentIndex( mScalingComboBox->findData( static_cast< int >( mFormat->inputValues() ) ) );
258+
mBlockSignals = false;
259+
}
260+
261+
QgsNumericFormat *QgsPercentageNumericFormatWidget::format()
262+
{
263+
return mFormat->clone();
264+
}
265+
266+
//
267+
// QgsScientificNumericFormatWidget
268+
//
269+
QgsScientificNumericFormatWidget::QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
270+
: QgsNumericFormatWidget( parent )
271+
{
272+
setupUi( this );
273+
setFormat( format->clone() );
274+
275+
connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
276+
{
277+
mFormat->setShowPlusSign( checked );
278+
if ( !mBlockSignals )
279+
emit changed();
280+
} );
281+
282+
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
283+
{
284+
mFormat->setShowTrailingZeros( checked );
285+
if ( !mBlockSignals )
286+
emit changed();
287+
} );
288+
289+
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
290+
{
291+
mFormat->setNumberDecimalPlaces( value );
292+
if ( !mBlockSignals )
293+
emit changed();
294+
} );
295+
}
296+
297+
QgsScientificNumericFormatWidget::~QgsScientificNumericFormatWidget() = default;
298+
299+
void QgsScientificNumericFormatWidget::setFormat( QgsNumericFormat *format )
300+
{
301+
mFormat.reset( static_cast< QgsScientificNumericFormat * >( format ) );
302+
303+
mBlockSignals = true;
304+
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
305+
mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
306+
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
307+
mBlockSignals = false;
308+
}
309+
310+
QgsNumericFormat *QgsScientificNumericFormatWidget::format()
311+
{
312+
return mFormat->clone();
313+
}
314+

‎src/gui/numericformats/qgsnumericformatwidget.h

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "qgis_sip.h"
1919
#include "qgsnumericformat.h"
2020
#include "qgspanelwidget.h"
21-
#include <QStandardItemModel>
21+
#include <memory>
2222

2323
/**
2424
* \ingroup gui
@@ -35,7 +35,7 @@ class GUI_EXPORT QgsNumericFormatWidget : public QgsPanelWidget
3535
/**
3636
* Constructor for QgsNumericFormatWidget.
3737
*/
38-
QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS )
38+
QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr )
3939
: QgsPanelWidget( parent )
4040
{}
4141

@@ -64,4 +64,124 @@ class GUI_EXPORT QgsNumericFormatWidget : public QgsPanelWidget
6464
};
6565

6666

67+
#include "ui_qgsbasicnumericformatwidgetbase.h"
68+
69+
class QgsBasicNumericFormat;
70+
71+
class GUI_EXPORT QgsBasicNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBasicNumericFormatWidgetBase
72+
{
73+
Q_OBJECT
74+
75+
public:
76+
77+
QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
78+
~QgsBasicNumericFormatWidget() override;
79+
80+
void setFormat( QgsNumericFormat *format ) override;
81+
82+
QgsNumericFormat *format() override SIP_FACTORY;
83+
84+
private:
85+
std::unique_ptr< QgsBasicNumericFormat > mFormat;
86+
bool mBlockSignals = false;
87+
88+
};
89+
90+
#include "ui_qgsbearingnumericformatwidgetbase.h"
91+
92+
class QgsBearingNumericFormat;
93+
94+
class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
95+
{
96+
Q_OBJECT
97+
98+
public:
99+
100+
QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
101+
~QgsBearingNumericFormatWidget() override;
102+
103+
void setFormat( QgsNumericFormat *format ) override;
104+
105+
QgsNumericFormat *format() override SIP_FACTORY;
106+
107+
private:
108+
std::unique_ptr< QgsBearingNumericFormat > mFormat;
109+
bool mBlockSignals = false;
110+
111+
};
112+
113+
114+
#include "ui_qgscurrencynumericformatwidgetbase.h"
115+
116+
class QgsCurrencyNumericFormat;
117+
118+
class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
119+
{
120+
Q_OBJECT
121+
122+
public:
123+
124+
QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
125+
~QgsCurrencyNumericFormatWidget() override;
126+
127+
void setFormat( QgsNumericFormat *format ) override;
128+
129+
QgsNumericFormat *format() override SIP_FACTORY;
130+
131+
private:
132+
std::unique_ptr< QgsCurrencyNumericFormat > mFormat;
133+
bool mBlockSignals = false;
134+
135+
};
136+
137+
138+
#include "ui_qgspercentagenumericformatwidgetbase.h"
139+
140+
class QgsPercentageNumericFormat;
141+
142+
class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
143+
{
144+
Q_OBJECT
145+
146+
public:
147+
148+
QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
149+
~QgsPercentageNumericFormatWidget() override;
150+
151+
void setFormat( QgsNumericFormat *format ) override;
152+
153+
QgsNumericFormat *format() override SIP_FACTORY;
154+
155+
private:
156+
std::unique_ptr< QgsPercentageNumericFormat > mFormat;
157+
bool mBlockSignals = false;
158+
159+
};
160+
161+
162+
163+
#include "ui_qgsscientificnumericformatwidgetbase.h"
164+
165+
class QgsScientificNumericFormat;
166+
167+
class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
168+
{
169+
Q_OBJECT
170+
171+
public:
172+
173+
QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
174+
~QgsScientificNumericFormatWidget() override;
175+
176+
void setFormat( QgsNumericFormat *format ) override;
177+
178+
QgsNumericFormat *format() override SIP_FACTORY;
179+
180+
private:
181+
std::unique_ptr< QgsScientificNumericFormat > mFormat;
182+
bool mBlockSignals = false;
183+
184+
};
185+
186+
67187
#endif // QGSNUMERICFORMATWIDGET_H
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>QgsBasicNumericFormatWidgetBase</class>
4+
<widget class="QgsPanelWidget" name="QgsBasicNumericFormatWidgetBase">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>245</width>
10+
<height>297</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<item row="0" column="0">
18+
<widget class="QLabel" name="label">
19+
<property name="text">
20+
<string>Decimal places</string>
21+
</property>
22+
</widget>
23+
</item>
24+
<item row="0" column="1">
25+
<widget class="QSpinBox" name="mDecimalsSpinBox">
26+
<property name="value">
27+
<number>6</number>
28+
</property>
29+
</widget>
30+
</item>
31+
<item row="4" column="0">
32+
<spacer name="verticalSpacer">
33+
<property name="orientation">
34+
<enum>Qt::Vertical</enum>
35+
</property>
36+
<property name="sizeHint" stdset="0">
37+
<size>
38+
<width>20</width>
39+
<height>40</height>
40+
</size>
41+
</property>
42+
</spacer>
43+
</item>
44+
<item row="1" column="0" colspan="2">
45+
<widget class="QCheckBox" name="mShowThousandsCheckBox">
46+
<property name="text">
47+
<string>Show thousands separator</string>
48+
</property>
49+
<property name="checked">
50+
<bool>true</bool>
51+
</property>
52+
</widget>
53+
</item>
54+
<item row="2" column="0" colspan="2">
55+
<widget class="QCheckBox" name="mShowPlusCheckBox">
56+
<property name="text">
57+
<string>Show plus sign</string>
58+
</property>
59+
</widget>
60+
</item>
61+
<item row="3" column="0" colspan="2">
62+
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
63+
<property name="text">
64+
<string>Show trailing zeros</string>
65+
</property>
66+
</widget>
67+
</item>
68+
</layout>
69+
</widget>
70+
<customwidgets>
71+
<customwidget>
72+
<class>QgsPanelWidget</class>
73+
<extends>QWidget</extends>
74+
<header>qgspanelwidget.h</header>
75+
<container>1</container>
76+
</customwidget>
77+
</customwidgets>
78+
<resources/>
79+
<connections/>
80+
</ui>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>QgsBearingNumericFormatWidgetBase</class>
4+
<widget class="QgsPanelWidget" name="QgsBearingNumericFormatWidgetBase">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>245</width>
10+
<height>297</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<item row="2" column="1">
18+
<widget class="QComboBox" name="mFormatComboBox"/>
19+
</item>
20+
<item row="0" column="1">
21+
<widget class="QSpinBox" name="mDecimalsSpinBox">
22+
<property name="value">
23+
<number>6</number>
24+
</property>
25+
</widget>
26+
</item>
27+
<item row="2" column="0">
28+
<widget class="QLabel" name="label_2">
29+
<property name="text">
30+
<string>Format</string>
31+
</property>
32+
</widget>
33+
</item>
34+
<item row="0" column="0">
35+
<widget class="QLabel" name="label">
36+
<property name="text">
37+
<string>Decimal places</string>
38+
</property>
39+
</widget>
40+
</item>
41+
<item row="3" column="0">
42+
<spacer name="verticalSpacer">
43+
<property name="orientation">
44+
<enum>Qt::Vertical</enum>
45+
</property>
46+
<property name="sizeHint" stdset="0">
47+
<size>
48+
<width>20</width>
49+
<height>40</height>
50+
</size>
51+
</property>
52+
</spacer>
53+
</item>
54+
<item row="1" column="0" colspan="2">
55+
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
56+
<property name="text">
57+
<string>Show trailing zeros</string>
58+
</property>
59+
</widget>
60+
</item>
61+
</layout>
62+
</widget>
63+
<customwidgets>
64+
<customwidget>
65+
<class>QgsPanelWidget</class>
66+
<extends>QWidget</extends>
67+
<header>qgspanelwidget.h</header>
68+
<container>1</container>
69+
</customwidget>
70+
</customwidgets>
71+
<resources/>
72+
<connections/>
73+
</ui>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>QgsCurrencyNumericFormatWidgetBase</class>
4+
<widget class="QgsPanelWidget" name="QgsCurrencyNumericFormatWidgetBase">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>245</width>
10+
<height>297</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<item row="0" column="0">
18+
<widget class="QLabel" name="label_2">
19+
<property name="text">
20+
<string>Prefix</string>
21+
</property>
22+
</widget>
23+
</item>
24+
<item row="4" column="0" colspan="2">
25+
<widget class="QCheckBox" name="mShowPlusCheckBox">
26+
<property name="text">
27+
<string>Show plus sign</string>
28+
</property>
29+
</widget>
30+
</item>
31+
<item row="5" column="0" colspan="2">
32+
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
33+
<property name="text">
34+
<string>Show trailing zeros</string>
35+
</property>
36+
</widget>
37+
</item>
38+
<item row="2" column="0">
39+
<widget class="QLabel" name="label">
40+
<property name="text">
41+
<string>Decimal places</string>
42+
</property>
43+
</widget>
44+
</item>
45+
<item row="2" column="1">
46+
<widget class="QSpinBox" name="mDecimalsSpinBox">
47+
<property name="value">
48+
<number>2</number>
49+
</property>
50+
</widget>
51+
</item>
52+
<item row="6" column="0">
53+
<spacer name="verticalSpacer">
54+
<property name="orientation">
55+
<enum>Qt::Vertical</enum>
56+
</property>
57+
<property name="sizeHint" stdset="0">
58+
<size>
59+
<width>20</width>
60+
<height>40</height>
61+
</size>
62+
</property>
63+
</spacer>
64+
</item>
65+
<item row="3" column="0" colspan="2">
66+
<widget class="QCheckBox" name="mShowThousandsCheckBox">
67+
<property name="text">
68+
<string>Show thousands separator</string>
69+
</property>
70+
<property name="checked">
71+
<bool>true</bool>
72+
</property>
73+
</widget>
74+
</item>
75+
<item row="1" column="0">
76+
<widget class="QLabel" name="label_3">
77+
<property name="text">
78+
<string>Suffix</string>
79+
</property>
80+
</widget>
81+
</item>
82+
<item row="0" column="1">
83+
<widget class="QLineEdit" name="mPrefixLineEdit">
84+
<property name="text">
85+
<string>$</string>
86+
</property>
87+
</widget>
88+
</item>
89+
<item row="1" column="1">
90+
<widget class="QLineEdit" name="mSuffixLineEdit"/>
91+
</item>
92+
</layout>
93+
</widget>
94+
<customwidgets>
95+
<customwidget>
96+
<class>QgsPanelWidget</class>
97+
<extends>QWidget</extends>
98+
<header>qgspanelwidget.h</header>
99+
<container>1</container>
100+
</customwidget>
101+
</customwidgets>
102+
<resources/>
103+
<connections/>
104+
</ui>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>QgsPercentageNumericFormatWidgetBase</class>
4+
<widget class="QgsPanelWidget" name="QgsPercentageNumericFormatWidgetBase">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>245</width>
10+
<height>297</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<item row="2" column="0" colspan="2">
18+
<widget class="QCheckBox" name="mShowPlusCheckBox">
19+
<property name="text">
20+
<string>Show plus sign</string>
21+
</property>
22+
</widget>
23+
</item>
24+
<item row="5" column="0">
25+
<spacer name="verticalSpacer">
26+
<property name="orientation">
27+
<enum>Qt::Vertical</enum>
28+
</property>
29+
<property name="sizeHint" stdset="0">
30+
<size>
31+
<width>20</width>
32+
<height>40</height>
33+
</size>
34+
</property>
35+
</spacer>
36+
</item>
37+
<item row="1" column="0" colspan="2">
38+
<widget class="QCheckBox" name="mShowThousandsCheckBox">
39+
<property name="text">
40+
<string>Show thousands separator</string>
41+
</property>
42+
<property name="checked">
43+
<bool>true</bool>
44+
</property>
45+
</widget>
46+
</item>
47+
<item row="0" column="1">
48+
<widget class="QSpinBox" name="mDecimalsSpinBox">
49+
<property name="value">
50+
<number>2</number>
51+
</property>
52+
</widget>
53+
</item>
54+
<item row="0" column="0">
55+
<widget class="QLabel" name="label">
56+
<property name="text">
57+
<string>Decimal places</string>
58+
</property>
59+
</widget>
60+
</item>
61+
<item row="3" column="0" colspan="2">
62+
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
63+
<property name="text">
64+
<string>Show trailing zeros</string>
65+
</property>
66+
</widget>
67+
</item>
68+
<item row="4" column="1">
69+
<widget class="QComboBox" name="mScalingComboBox"/>
70+
</item>
71+
<item row="4" column="0">
72+
<widget class="QLabel" name="label_2">
73+
<property name="text">
74+
<string>Scaling</string>
75+
</property>
76+
</widget>
77+
</item>
78+
</layout>
79+
</widget>
80+
<customwidgets>
81+
<customwidget>
82+
<class>QgsPanelWidget</class>
83+
<extends>QWidget</extends>
84+
<header>qgspanelwidget.h</header>
85+
<container>1</container>
86+
</customwidget>
87+
</customwidgets>
88+
<resources/>
89+
<connections/>
90+
</ui>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>QgsScientificNumericFormatWidgetBase</class>
4+
<widget class="QgsPanelWidget" name="QgsScientificNumericFormatWidgetBase">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>245</width>
10+
<height>297</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<item row="0" column="1">
18+
<widget class="QSpinBox" name="mDecimalsSpinBox">
19+
<property name="value">
20+
<number>6</number>
21+
</property>
22+
</widget>
23+
</item>
24+
<item row="2" column="0" colspan="2">
25+
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
26+
<property name="text">
27+
<string>Show trailing zeros</string>
28+
</property>
29+
</widget>
30+
</item>
31+
<item row="0" column="0">
32+
<widget class="QLabel" name="label">
33+
<property name="text">
34+
<string>Decimal places</string>
35+
</property>
36+
</widget>
37+
</item>
38+
<item row="3" column="0">
39+
<spacer name="verticalSpacer">
40+
<property name="orientation">
41+
<enum>Qt::Vertical</enum>
42+
</property>
43+
<property name="sizeHint" stdset="0">
44+
<size>
45+
<width>20</width>
46+
<height>40</height>
47+
</size>
48+
</property>
49+
</spacer>
50+
</item>
51+
<item row="1" column="0" colspan="2">
52+
<widget class="QCheckBox" name="mShowPlusCheckBox">
53+
<property name="text">
54+
<string>Show plus sign</string>
55+
</property>
56+
</widget>
57+
</item>
58+
</layout>
59+
</widget>
60+
<customwidgets>
61+
<customwidget>
62+
<class>QgsPanelWidget</class>
63+
<extends>QWidget</extends>
64+
<header>qgspanelwidget.h</header>
65+
<container>1</container>
66+
</customwidget>
67+
</customwidgets>
68+
<resources/>
69+
<connections/>
70+
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.