29 mFormatNumbersCheckBox->setTristate(
false );
31 mFontButton->setShowNullFormat(
true );
32 mFontButton->setNoFormatString( tr(
"Clear Formatting" ) );
34 mBackgroundColorButton->setAllowOpacity(
true );
35 mBackgroundColorButton->setColorDialogTitle( tr(
"Background Color" ) );
36 mBackgroundColorButton->setDefaultColor( QColor( 255, 255, 255 ) );
37 mBackgroundColorButton->setShowNull(
true );
39 mHorizontalAlignComboBox->setAvailableAlignments( Qt::AlignLeft | Qt::AlignHCenter | Qt::AlignRight | Qt::AlignJustify );
40 mVerticalAlignComboBox->setAvailableAlignments( Qt::AlignTop | Qt::AlignVCenter | Qt::AlignBottom );
42 mRowHeightSpinBox->setClearValue( 0, tr(
"Automatic" ) );
43 mColumnWidthSpinBox->setClearValue( 0, tr(
"Automatic" ) );
56 connect( mFormatNumbersCheckBox, &QCheckBox::stateChanged,
this, [ = ](
int state )
58 mCustomizeFormatButton->setEnabled( state == Qt::Checked );
59 if ( state != Qt::PartiallyChecked )
60 mFormatNumbersCheckBox->setTristate(
false );
71 mCustomizeFormatButton->setEnabled(
false );
72 connect( mCustomizeFormatButton, &QPushButton::clicked,
this, [ = ]
75 widget->
setFormat( mNumericFormat.get() );
79 mNumericFormat.reset( widget->
format() );
85 connect( mRowHeightSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double height )
92 mRowHeightSpinBox->setClearValue( 0, tr(
"Automatic" ) );
96 connect( mColumnWidthSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double width )
103 mColumnWidthSpinBox->setClearValue( 0, tr(
"Automatic" ) );
110 if ( !mBlockSignals )
118 if ( !mBlockSignals )
126 if ( !mBlockSignals )
132 mExpressionEdit->setAllowEmptyFieldName(
true );
134 mExpressionEdit->registerExpressionContextGenerator(
this );
135 mFontButton->registerExpressionContextGenerator(
this );
140 if ( !mNumericFormat || mFormatNumbersCheckBox->checkState() != Qt::Checked )
143 return mNumericFormat->clone();
148 return mFontButton->textFormat();
154 mBackgroundColorButton->setColor( color );
160 mNumericFormat.reset( format ? format->
clone() :
nullptr );
162 mFormatNumbersCheckBox->setTristate( isMixedFormat );
163 mFormatNumbersCheckBox->setCheckState( isMixedFormat ? Qt::PartiallyChecked : ( mNumericFormat.get() ? Qt::Checked : Qt::Unchecked ) );
170 mFontButton->setTextFormat( format );
178 mRowHeightSpinBox->setClearValue( 0, tr(
"Mixed" ) );
180 mRowHeightSpinBox->setClearValue( 0, tr(
"Automatic" ) );
181 mRowHeightSpinBox->setValue( height < 0 ? 0 : height );
189 mColumnWidthSpinBox->setClearValue( 0, tr(
"Mixed" ) );
191 mColumnWidthSpinBox->setClearValue( 0, tr(
"Automatic" ) );
192 mColumnWidthSpinBox->setValue( width < 0 ? 0 : width );
199 if ( alignment & Qt::AlignHorizontal_Mask && alignment & Qt::AlignVertical_Mask )
200 mHorizontalAlignComboBox->setCurrentIndex( -1 );
202 mHorizontalAlignComboBox->setCurrentAlignment( alignment );
209 if ( alignment & Qt::AlignHorizontal_Mask && alignment & Qt::AlignVertical_Mask )
210 mVerticalAlignComboBox->setCurrentIndex( -1 );
212 mVerticalAlignComboBox->setCurrentAlignment( alignment );
220 mExpressionEdit->setExpression( QString() );
222 mExpressionEdit->setExpression( property.
asExpression() );
228 mContextGenerator = generator;
234 if ( mContextGenerator )
239 cellScope->
setVariable( QStringLiteral(
"row_number" ), 0 );
240 cellScope->
setVariable( QStringLiteral(
"column_number" ), 0 );
243 context.
setHighlightedVariables( QStringList() << QStringLiteral(
"row_number" ) << QStringLiteral(
"column_number" ) );
void changed()
Emitted when the alignment is changed.
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Single scope for storing variables and functions for use within a QgsExpressionContext.
void setVariable(const QString &name, const QVariant &value, bool isStatic=false)
Convenience method for setting a variable in the context scope by name name and value.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
A store for object properties.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
bool isActive() const
Returns whether the property is currently active.
Container for all settings relating to text rendering.