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 );
50 connect( mFilterLineEdit, &QLineEdit::textChanged,
this, [
this] { emit
widgetChanged(); } );
51 connect( mFilterButton, &QToolButton::clicked,
this, &QgsLayoutChartSeriesDetailsWidget::mFilterButton_clicked );
61 return mXExpressionWidget->asExpression();
66 return mYExpressionWidget->asExpression();
71 return mFilterLineEdit->text();
74void QgsLayoutChartSeriesDetailsWidget::mFilterButton_clicked()
80 QgsExpressionBuilderDialog expressionBuilderDialog( mVectorLayer.data(), mFilterLineEdit->text(),
this, u
"generic"_s, context );
82 expressionBuilderDialog.setWindowTitle( tr(
"Expression Based Filter" ) );
84 if ( expressionBuilderDialog.exec() == QDialog::Accepted )
86 const QString expression = expressionBuilderDialog.expressionText();
87 if ( !expression.isEmpty() )
89 mFilterLineEdit->setText( expression );
96 mExpressionContextGenerator = generator;
102 if ( mExpressionContextGenerator )
104 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.