25#include "moc_qgslayoutchartseriesdetailswidget.cpp"
27using namespace Qt::StringLiterals;
31 , mVectorLayer( layer )
38 mXExpressionWidget->setLayer( mVectorLayer.data() );
39 mYExpressionWidget->setLayer( mVectorLayer.data() );
42 mXExpressionWidget->setExpression( seriesDetails.
xExpression() );
43 mXExpressionWidget->registerExpressionContextGenerator(
this );
44 mYExpressionWidget->setExpression( seriesDetails.
yExpression() );
45 mYExpressionWidget->registerExpressionContextGenerator(
this );
54 connect( mFilterLineEdit, &QLineEdit::textChanged,
this, [
this] { emit
widgetChanged(); } );
55 connect( mFilterButton, &QToolButton::clicked,
this, &QgsLayoutChartSeriesDetailsWidget::mFilterButton_clicked );
65 return mXExpressionWidget->asExpression();
70 return mYExpressionWidget->asExpression();
75 return mFilterLineEdit->text();
78void QgsLayoutChartSeriesDetailsWidget::mFilterButton_clicked()
84 QgsExpressionBuilderDialog expressionBuilderDialog( mVectorLayer.data(), mFilterLineEdit->text(),
this, u
"generic"_s, context );
86 expressionBuilderDialog.setWindowTitle( tr(
"Expression Based Filter" ) );
88 if ( expressionBuilderDialog.exec() == QDialog::Accepted )
90 const QString expression = expressionBuilderDialog.expressionText();
91 if ( !expression.isEmpty() )
93 mFilterLineEdit->setText( expression );
100 mExpressionContextGenerator = generator;
106 if ( mExpressionContextGenerator )
108 context = mExpressionContextGenerator->createExpressionContext();
A generic dialog for building expression strings.
Abstract interface for generating an expression context.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
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.
Chart series details covering all supported series types.
QString yExpression() const
Returns the expression used to generate Y-axis values.
QString filterExpression() const
Returns the filter expression used to generate a series against a subset of the source layer.
QString xExpression() const
Returns the expression used to generate X-axis values.
Represents a vector layer which manages a vector based dataset.