mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-05 00:04:40 -05:00
Add configuration widgets for all numeric format types
This commit is contained in:
parent
1d6bc57df5
commit
f5e965aa86
@ -20,7 +20,7 @@ Base class for widgets which allow control over the properties of QgsNumericForm
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsNumericFormatWidget( QWidget *parent /TransferThis/ );
|
||||
QgsNumericFormatWidget( QWidget *parent /TransferThis/ = 0 );
|
||||
%Docstring
|
||||
Constructor for QgsNumericFormatWidget.
|
||||
%End
|
||||
@ -51,6 +51,116 @@ Emitted whenever the configuration of the numeric format is changed.
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsBasicNumericFormatWidget : QgsNumericFormatWidget
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsnumericformatwidget.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
|
||||
~QgsBasicNumericFormatWidget();
|
||||
|
||||
virtual void setFormat( QgsNumericFormat *format );
|
||||
|
||||
|
||||
virtual QgsNumericFormat *format() /Factory/;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class QgsBearingNumericFormatWidget : QgsNumericFormatWidget
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsnumericformatwidget.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
|
||||
~QgsBearingNumericFormatWidget();
|
||||
|
||||
virtual void setFormat( QgsNumericFormat *format );
|
||||
|
||||
|
||||
virtual QgsNumericFormat *format() /Factory/;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsCurrencyNumericFormatWidget : QgsNumericFormatWidget
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsnumericformatwidget.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
|
||||
~QgsCurrencyNumericFormatWidget();
|
||||
|
||||
virtual void setFormat( QgsNumericFormat *format );
|
||||
|
||||
|
||||
virtual QgsNumericFormat *format() /Factory/;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsPercentageNumericFormatWidget : QgsNumericFormatWidget
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsnumericformatwidget.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
|
||||
~QgsPercentageNumericFormatWidget();
|
||||
|
||||
virtual void setFormat( QgsNumericFormat *format );
|
||||
|
||||
|
||||
virtual QgsNumericFormat *format() /Factory/;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsScientificNumericFormatWidget : QgsNumericFormatWidget
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsnumericformatwidget.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent /TransferThis/ = 0 );
|
||||
~QgsScientificNumericFormatWidget();
|
||||
|
||||
virtual void setFormat( QgsNumericFormat *format );
|
||||
|
||||
|
||||
virtual QgsNumericFormat *format() /Factory/;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
QgsCurrencyNumericFormat::QgsCurrencyNumericFormat()
|
||||
: mPrefix( QStringLiteral( "$" ) )
|
||||
{
|
||||
setNumberDecimalPlaces( 2 );
|
||||
}
|
||||
|
||||
QString QgsCurrencyNumericFormat::id() const
|
||||
@ -58,6 +59,10 @@ QgsNumericFormat *QgsCurrencyNumericFormat::create( const QVariantMap &configura
|
||||
res->setConfiguration( configuration, context );
|
||||
res->mPrefix = configuration.value( QStringLiteral( "prefix" ), QStringLiteral( "$" ) ).toString();
|
||||
res->mSuffix = configuration.value( QStringLiteral( "suffix" ), QString() ).toString();
|
||||
|
||||
// override base class default for number of decimal places -- we want to default to 2
|
||||
res->setNumberDecimalPlaces( configuration.value( QStringLiteral( "decimals" ), 2 ).toInt() );
|
||||
|
||||
return res.release();
|
||||
}
|
||||
|
||||
|
||||
@ -19,9 +19,65 @@
|
||||
#include "qgis.h"
|
||||
#include "qgsnumericformatwidget.h"
|
||||
|
||||
|
||||
class QgsBasicNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
|
||||
{
|
||||
return new QgsBasicNumericFormatWidget( format );
|
||||
}
|
||||
};
|
||||
|
||||
class QgsBearingNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
|
||||
{
|
||||
return new QgsBearingNumericFormatWidget( format );
|
||||
}
|
||||
};
|
||||
|
||||
class QgsCurrencyNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
|
||||
{
|
||||
return new QgsCurrencyNumericFormatWidget( format );
|
||||
}
|
||||
};
|
||||
|
||||
class QgsPercentageNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
|
||||
{
|
||||
return new QgsPercentageNumericFormatWidget( format );
|
||||
}
|
||||
};
|
||||
|
||||
class QgsScientificNumericFormatConfigurationWidgetFactory : public QgsNumericFormatConfigurationWidgetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
QgsNumericFormatWidget *create( const QgsNumericFormat *format ) const
|
||||
{
|
||||
return new QgsScientificNumericFormatWidget( format );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
QgsNumericFormatGuiRegistry::QgsNumericFormatGuiRegistry()
|
||||
{
|
||||
// addFormatConfigurationWidgetFactory( new QgsFilterAlgorithmConfigurationWidgetFactory() );
|
||||
addFormatConfigurationWidgetFactory( QStringLiteral( "basic" ), new QgsBasicNumericFormatConfigurationWidgetFactory() );
|
||||
addFormatConfigurationWidgetFactory( QStringLiteral( "bearing" ), new QgsBearingNumericFormatConfigurationWidgetFactory() );
|
||||
addFormatConfigurationWidgetFactory( QStringLiteral( "currency" ), new QgsCurrencyNumericFormatConfigurationWidgetFactory() );
|
||||
addFormatConfigurationWidgetFactory( QStringLiteral( "percentage" ), new QgsPercentageNumericFormatConfigurationWidgetFactory() );
|
||||
addFormatConfigurationWidgetFactory( QStringLiteral( "scientific" ), new QgsScientificNumericFormatConfigurationWidgetFactory() );
|
||||
}
|
||||
|
||||
QgsNumericFormatGuiRegistry::~QgsNumericFormatGuiRegistry()
|
||||
|
||||
@ -14,3 +14,301 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsnumericformatwidget.h"
|
||||
#include "qgsbasicnumericformat.h"
|
||||
#include "qgscurrencynumericformat.h"
|
||||
#include "qgspercentagenumericformat.h"
|
||||
#include "qgsbearingnumericformat.h"
|
||||
#include "qgsscientificnumericformat.h"
|
||||
#include "qgis.h"
|
||||
|
||||
//
|
||||
// QgsBasicNumericFormatWidget
|
||||
//
|
||||
QgsBasicNumericFormatWidget::QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
|
||||
: QgsNumericFormatWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
setFormat( format->clone() );
|
||||
|
||||
connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowPlusSign( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowTrailingZeros( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowThousandsSeparator( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
|
||||
{
|
||||
mFormat->setNumberDecimalPlaces( value );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
}
|
||||
|
||||
QgsBasicNumericFormatWidget::~QgsBasicNumericFormatWidget() = default;
|
||||
|
||||
void QgsBasicNumericFormatWidget::setFormat( QgsNumericFormat *format )
|
||||
{
|
||||
mFormat.reset( static_cast< QgsBasicNumericFormat * >( format ) );
|
||||
|
||||
mBlockSignals = true;
|
||||
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
|
||||
mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
|
||||
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
|
||||
mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
|
||||
mBlockSignals = false;
|
||||
}
|
||||
|
||||
QgsNumericFormat *QgsBasicNumericFormatWidget::format()
|
||||
{
|
||||
return mFormat->clone();
|
||||
}
|
||||
|
||||
//
|
||||
// QgsBearingNumericFormatWidget
|
||||
//
|
||||
|
||||
QgsBearingNumericFormatWidget::QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
|
||||
: QgsNumericFormatWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
mFormatComboBox->addItem( QObject::tr( "0 to 180°, with E/W suffix" ), QgsBearingNumericFormat::UseRange0To180WithEWDirectionalSuffix );
|
||||
mFormatComboBox->addItem( QObject::tr( "-180 to +180°" ), QgsBearingNumericFormat::UseRangeNegative180ToPositive180 );
|
||||
mFormatComboBox->addItem( QObject::tr( "0 to 360°" ), QgsBearingNumericFormat::UseRange0To360 );
|
||||
|
||||
setFormat( format->clone() );
|
||||
|
||||
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowTrailingZeros( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
|
||||
{
|
||||
mFormat->setNumberDecimalPlaces( value );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mFormatComboBox, qgis::overload<int>::of( &QComboBox::currentIndexChanged ), this, [ = ]( int )
|
||||
{
|
||||
mFormat->setDirectionFormat( static_cast < QgsBearingNumericFormat::FormatDirectionOption >( mFormatComboBox->currentData().toInt() ) );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
}
|
||||
|
||||
QgsBearingNumericFormatWidget::~QgsBearingNumericFormatWidget() = default;
|
||||
|
||||
void QgsBearingNumericFormatWidget::setFormat( QgsNumericFormat *format )
|
||||
{
|
||||
mFormat.reset( static_cast< QgsBearingNumericFormat * >( format ) );
|
||||
|
||||
mBlockSignals = true;
|
||||
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
|
||||
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
|
||||
mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( static_cast< int >( mFormat->directionFormat() ) ) );
|
||||
mBlockSignals = false;
|
||||
}
|
||||
|
||||
QgsNumericFormat *QgsBearingNumericFormatWidget::format()
|
||||
{
|
||||
return mFormat->clone();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// QgsCurrencyNumericFormatWidget
|
||||
//
|
||||
QgsCurrencyNumericFormatWidget::QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
|
||||
: QgsNumericFormatWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
setFormat( format->clone() );
|
||||
|
||||
connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowPlusSign( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowTrailingZeros( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowThousandsSeparator( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
|
||||
{
|
||||
mFormat->setNumberDecimalPlaces( value );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mPrefixLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
|
||||
{
|
||||
mFormat->setPrefix( text );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mSuffixLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
|
||||
{
|
||||
mFormat->setSuffix( text );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
}
|
||||
|
||||
QgsCurrencyNumericFormatWidget::~QgsCurrencyNumericFormatWidget() = default;
|
||||
|
||||
void QgsCurrencyNumericFormatWidget::setFormat( QgsNumericFormat *format )
|
||||
{
|
||||
mFormat.reset( static_cast< QgsCurrencyNumericFormat * >( format ) );
|
||||
|
||||
mBlockSignals = true;
|
||||
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
|
||||
mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
|
||||
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
|
||||
mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
|
||||
mPrefixLineEdit->setText( mFormat->prefix() );
|
||||
mSuffixLineEdit->setText( mFormat->suffix() );
|
||||
|
||||
mBlockSignals = false;
|
||||
}
|
||||
|
||||
QgsNumericFormat *QgsCurrencyNumericFormatWidget::format()
|
||||
{
|
||||
return mFormat->clone();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// QgsPercentageNumericFormatWidget
|
||||
//
|
||||
|
||||
QgsPercentageNumericFormatWidget::QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
|
||||
: QgsNumericFormatWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
mScalingComboBox->addItem( QObject::tr( "Values are Percentages (e.g. 50)" ), QgsPercentageNumericFormat::ValuesArePercentage );
|
||||
mScalingComboBox->addItem( QObject::tr( "Values are Fractions (e.g. 0.5)" ), QgsPercentageNumericFormat::ValuesAreFractions );
|
||||
|
||||
setFormat( format->clone() );
|
||||
|
||||
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowTrailingZeros( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
|
||||
{
|
||||
mFormat->setNumberDecimalPlaces( value );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mScalingComboBox, qgis::overload<int>::of( &QComboBox::currentIndexChanged ), this, [ = ]( int )
|
||||
{
|
||||
mFormat->setInputValues( static_cast < QgsPercentageNumericFormat::InputValues >( mScalingComboBox->currentData().toInt() ) );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
}
|
||||
|
||||
QgsPercentageNumericFormatWidget::~QgsPercentageNumericFormatWidget() = default;
|
||||
|
||||
void QgsPercentageNumericFormatWidget::setFormat( QgsNumericFormat *format )
|
||||
{
|
||||
mFormat.reset( static_cast< QgsPercentageNumericFormat * >( format ) );
|
||||
|
||||
mBlockSignals = true;
|
||||
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
|
||||
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
|
||||
mScalingComboBox->setCurrentIndex( mScalingComboBox->findData( static_cast< int >( mFormat->inputValues() ) ) );
|
||||
mBlockSignals = false;
|
||||
}
|
||||
|
||||
QgsNumericFormat *QgsPercentageNumericFormatWidget::format()
|
||||
{
|
||||
return mFormat->clone();
|
||||
}
|
||||
|
||||
//
|
||||
// QgsScientificNumericFormatWidget
|
||||
//
|
||||
QgsScientificNumericFormatWidget::QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent )
|
||||
: QgsNumericFormatWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
setFormat( format->clone() );
|
||||
|
||||
connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowPlusSign( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
mFormat->setShowTrailingZeros( checked );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
|
||||
connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int value )
|
||||
{
|
||||
mFormat->setNumberDecimalPlaces( value );
|
||||
if ( !mBlockSignals )
|
||||
emit changed();
|
||||
} );
|
||||
}
|
||||
|
||||
QgsScientificNumericFormatWidget::~QgsScientificNumericFormatWidget() = default;
|
||||
|
||||
void QgsScientificNumericFormatWidget::setFormat( QgsNumericFormat *format )
|
||||
{
|
||||
mFormat.reset( static_cast< QgsScientificNumericFormat * >( format ) );
|
||||
|
||||
mBlockSignals = true;
|
||||
mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
|
||||
mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
|
||||
mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
|
||||
mBlockSignals = false;
|
||||
}
|
||||
|
||||
QgsNumericFormat *QgsScientificNumericFormatWidget::format()
|
||||
{
|
||||
return mFormat->clone();
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "qgis_sip.h"
|
||||
#include "qgsnumericformat.h"
|
||||
#include "qgspanelwidget.h"
|
||||
#include <QStandardItemModel>
|
||||
#include <memory>
|
||||
|
||||
/**
|
||||
* \ingroup gui
|
||||
@ -35,7 +35,7 @@ class GUI_EXPORT QgsNumericFormatWidget : public QgsPanelWidget
|
||||
/**
|
||||
* Constructor for QgsNumericFormatWidget.
|
||||
*/
|
||||
QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS )
|
||||
QgsNumericFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr )
|
||||
: QgsPanelWidget( parent )
|
||||
{}
|
||||
|
||||
@ -64,4 +64,124 @@ class GUI_EXPORT QgsNumericFormatWidget : public QgsPanelWidget
|
||||
};
|
||||
|
||||
|
||||
#include "ui_qgsbasicnumericformatwidgetbase.h"
|
||||
|
||||
class QgsBasicNumericFormat;
|
||||
|
||||
class GUI_EXPORT QgsBasicNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBasicNumericFormatWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
QgsBasicNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
|
||||
~QgsBasicNumericFormatWidget() override;
|
||||
|
||||
void setFormat( QgsNumericFormat *format ) override;
|
||||
|
||||
QgsNumericFormat *format() override SIP_FACTORY;
|
||||
|
||||
private:
|
||||
std::unique_ptr< QgsBasicNumericFormat > mFormat;
|
||||
bool mBlockSignals = false;
|
||||
|
||||
};
|
||||
|
||||
#include "ui_qgsbearingnumericformatwidgetbase.h"
|
||||
|
||||
class QgsBearingNumericFormat;
|
||||
|
||||
class GUI_EXPORT QgsBearingNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsBearingNumericFormatWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
QgsBearingNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
|
||||
~QgsBearingNumericFormatWidget() override;
|
||||
|
||||
void setFormat( QgsNumericFormat *format ) override;
|
||||
|
||||
QgsNumericFormat *format() override SIP_FACTORY;
|
||||
|
||||
private:
|
||||
std::unique_ptr< QgsBearingNumericFormat > mFormat;
|
||||
bool mBlockSignals = false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include "ui_qgscurrencynumericformatwidgetbase.h"
|
||||
|
||||
class QgsCurrencyNumericFormat;
|
||||
|
||||
class GUI_EXPORT QgsCurrencyNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsCurrencyNumericFormatWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
QgsCurrencyNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
|
||||
~QgsCurrencyNumericFormatWidget() override;
|
||||
|
||||
void setFormat( QgsNumericFormat *format ) override;
|
||||
|
||||
QgsNumericFormat *format() override SIP_FACTORY;
|
||||
|
||||
private:
|
||||
std::unique_ptr< QgsCurrencyNumericFormat > mFormat;
|
||||
bool mBlockSignals = false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include "ui_qgspercentagenumericformatwidgetbase.h"
|
||||
|
||||
class QgsPercentageNumericFormat;
|
||||
|
||||
class GUI_EXPORT QgsPercentageNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsPercentageNumericFormatWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
QgsPercentageNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
|
||||
~QgsPercentageNumericFormatWidget() override;
|
||||
|
||||
void setFormat( QgsNumericFormat *format ) override;
|
||||
|
||||
QgsNumericFormat *format() override SIP_FACTORY;
|
||||
|
||||
private:
|
||||
std::unique_ptr< QgsPercentageNumericFormat > mFormat;
|
||||
bool mBlockSignals = false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#include "ui_qgsscientificnumericformatwidgetbase.h"
|
||||
|
||||
class QgsScientificNumericFormat;
|
||||
|
||||
class GUI_EXPORT QgsScientificNumericFormatWidget : public QgsNumericFormatWidget, private Ui::QgsScientificNumericFormatWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
QgsScientificNumericFormatWidget( const QgsNumericFormat *format, QWidget *parent SIP_TRANSFERTHIS = nullptr );
|
||||
~QgsScientificNumericFormatWidget() override;
|
||||
|
||||
void setFormat( QgsNumericFormat *format ) override;
|
||||
|
||||
QgsNumericFormat *format() override SIP_FACTORY;
|
||||
|
||||
private:
|
||||
std::unique_ptr< QgsScientificNumericFormat > mFormat;
|
||||
bool mBlockSignals = false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // QGSNUMERICFORMATWIDGET_H
|
||||
|
||||
80
src/ui/numericformats/qgsbasicnumericformatwidgetbase.ui
Normal file
80
src/ui/numericformats/qgsbasicnumericformatwidgetbase.ui
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsBasicNumericFormatWidgetBase</class>
|
||||
<widget class="QgsPanelWidget" name="QgsBasicNumericFormatWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>245</width>
|
||||
<height>297</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Decimal places</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="mDecimalsSpinBox">
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowThousandsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show thousands separator</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowPlusCheckBox">
|
||||
<property name="text">
|
||||
<string>Show plus sign</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
|
||||
<property name="text">
|
||||
<string>Show trailing zeros</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsPanelWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgspanelwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
73
src/ui/numericformats/qgsbearingnumericformatwidgetbase.ui
Normal file
73
src/ui/numericformats/qgsbearingnumericformatwidgetbase.ui
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsBearingNumericFormatWidgetBase</class>
|
||||
<widget class="QgsPanelWidget" name="QgsBearingNumericFormatWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>245</width>
|
||||
<height>297</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="mFormatComboBox"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="mDecimalsSpinBox">
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Decimal places</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
|
||||
<property name="text">
|
||||
<string>Show trailing zeros</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsPanelWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgspanelwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
104
src/ui/numericformats/qgscurrencynumericformatwidgetbase.ui
Normal file
104
src/ui/numericformats/qgscurrencynumericformatwidgetbase.ui
Normal file
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsCurrencyNumericFormatWidgetBase</class>
|
||||
<widget class="QgsPanelWidget" name="QgsCurrencyNumericFormatWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>245</width>
|
||||
<height>297</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Prefix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowPlusCheckBox">
|
||||
<property name="text">
|
||||
<string>Show plus sign</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
|
||||
<property name="text">
|
||||
<string>Show trailing zeros</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Decimal places</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="mDecimalsSpinBox">
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowThousandsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show thousands separator</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Suffix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="mPrefixLineEdit">
|
||||
<property name="text">
|
||||
<string>$</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="mSuffixLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsPanelWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgspanelwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsPercentageNumericFormatWidgetBase</class>
|
||||
<widget class="QgsPanelWidget" name="QgsPercentageNumericFormatWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>245</width>
|
||||
<height>297</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowPlusCheckBox">
|
||||
<property name="text">
|
||||
<string>Show plus sign</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowThousandsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show thousands separator</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="mDecimalsSpinBox">
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Decimal places</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
|
||||
<property name="text">
|
||||
<string>Show trailing zeros</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="mScalingComboBox"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Scaling</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsPanelWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgspanelwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsScientificNumericFormatWidgetBase</class>
|
||||
<widget class="QgsPanelWidget" name="QgsScientificNumericFormatWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>245</width>
|
||||
<height>297</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="mDecimalsSpinBox">
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowTrailingZerosCheckBox">
|
||||
<property name="text">
|
||||
<string>Show trailing zeros</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Decimal places</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mShowPlusCheckBox">
|
||||
<property name="text">
|
||||
<string>Show plus sign</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsPanelWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgspanelwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
x
Reference in New Issue
Block a user