mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-28 00:05:04 -04:00
More contexts for expression builder dialogs
This commit is contained in:
parent
a7d8519c7f
commit
1c1e574d64
@ -181,7 +181,12 @@ void QgsAttributeActionDialog::insertExpression()
|
|||||||
selText = selText.mid( 2, selText.size() - 4 );
|
selText = selText.mid( 2, selText.size() - 4 );
|
||||||
|
|
||||||
// display the expression builder
|
// display the expression builder
|
||||||
QgsExpressionBuilderDialog dlg( mActions->layer(), selText, this );
|
QgsExpressionContext context;
|
||||||
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
|
<< QgsExpressionContextUtils::projectScope()
|
||||||
|
<< QgsExpressionContextUtils::layerScope( mActions->layer() );
|
||||||
|
|
||||||
|
QgsExpressionBuilderDialog dlg( mActions->layer(), selText, this, "generic", context );
|
||||||
dlg.setWindowTitle( tr( "Insert expression" ) );
|
dlg.setWindowTitle( tr( "Insert expression" ) );
|
||||||
|
|
||||||
QgsDistanceArea myDa;
|
QgsDistanceArea myDa;
|
||||||
|
@ -460,7 +460,12 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
|
|||||||
void QgsAttributeTableDialog::filterExpressionBuilder()
|
void QgsAttributeTableDialog::filterExpressionBuilder()
|
||||||
{
|
{
|
||||||
// Show expression builder
|
// Show expression builder
|
||||||
QgsExpressionBuilderDialog dlg( mLayer, mFilterQuery->text(), this );
|
QgsExpressionContext context;
|
||||||
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
|
<< QgsExpressionContextUtils::projectScope()
|
||||||
|
<< QgsExpressionContextUtils::layerScope( mLayer );
|
||||||
|
|
||||||
|
QgsExpressionBuilderDialog dlg( mLayer, mFilterQuery->text(), this, "generic", context );
|
||||||
dlg.setWindowTitle( tr( "Expression based filter" ) );
|
dlg.setWindowTitle( tr( "Expression based filter" ) );
|
||||||
|
|
||||||
QgsDistanceArea myDa;
|
QgsDistanceArea myDa;
|
||||||
|
@ -776,7 +776,13 @@ void QgsDiagramProperties::showAddAttributeExpressionDialog()
|
|||||||
{
|
{
|
||||||
expression = selections[0]->text( 0 );
|
expression = selections[0]->text( 0 );
|
||||||
}
|
}
|
||||||
QgsExpressionBuilderDialog dlg( mLayer, expression, this );
|
|
||||||
|
QgsExpressionContext context;
|
||||||
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
|
<< QgsExpressionContextUtils::projectScope()
|
||||||
|
<< QgsExpressionContextUtils::layerScope( mLayer );
|
||||||
|
|
||||||
|
QgsExpressionBuilderDialog dlg( mLayer, expression, this, "generic", context );
|
||||||
dlg.setWindowTitle( tr( "Expression based attribute" ) );
|
dlg.setWindowTitle( tr( "Expression based attribute" ) );
|
||||||
|
|
||||||
QgsDistanceArea myDa;
|
QgsDistanceArea myDa;
|
||||||
|
@ -669,7 +669,11 @@ void QgsFieldsProperties::updateExpression()
|
|||||||
|
|
||||||
const QString exp = mLayer->expressionField( index );
|
const QString exp = mLayer->expressionField( index );
|
||||||
|
|
||||||
QgsExpressionBuilderDialog dlg( mLayer, exp );
|
QgsExpressionContext context;
|
||||||
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
|
<< QgsExpressionContextUtils::projectScope();
|
||||||
|
|
||||||
|
QgsExpressionBuilderDialog dlg( mLayer, exp, 0, "generic", context );
|
||||||
|
|
||||||
if ( dlg.exec() )
|
if ( dlg.exec() )
|
||||||
{
|
{
|
||||||
|
@ -345,7 +345,12 @@ void QgsVectorLayerProperties::insertExpression()
|
|||||||
selText = selText.mid( 2, selText.size() - 4 );
|
selText = selText.mid( 2, selText.size() - 4 );
|
||||||
|
|
||||||
// display the expression builder
|
// display the expression builder
|
||||||
QgsExpressionBuilderDialog dlg( layer, selText.replace( QChar::ParagraphSeparator, '\n' ), this );
|
QgsExpressionContext context;
|
||||||
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
|
<< QgsExpressionContextUtils::projectScope()
|
||||||
|
<< QgsExpressionContextUtils::layerScope( layer );
|
||||||
|
|
||||||
|
QgsExpressionBuilderDialog dlg( layer, selText.replace( QChar::ParagraphSeparator, '\n' ), this, "generic", context );
|
||||||
dlg.setWindowTitle( tr( "Insert expression" ) );
|
dlg.setWindowTitle( tr( "Insert expression" ) );
|
||||||
if ( dlg.exec() == QDialog::Accepted )
|
if ( dlg.exec() == QDialog::Accepted )
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,12 @@ void QgsDualView::openConditionalStyles()
|
|||||||
void QgsDualView::previewExpressionBuilder()
|
void QgsDualView::previewExpressionBuilder()
|
||||||
{
|
{
|
||||||
// Show expression builder
|
// Show expression builder
|
||||||
QgsExpressionBuilderDialog dlg( mLayerCache->layer(), mFeatureList->displayExpression(), this );
|
QgsExpressionContext context;
|
||||||
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
|
<< QgsExpressionContextUtils::projectScope()
|
||||||
|
<< QgsExpressionContextUtils::layerScope( mLayerCache->layer() );
|
||||||
|
|
||||||
|
QgsExpressionBuilderDialog dlg( mLayerCache->layer(), mFeatureList->displayExpression(), this, "generic", context );
|
||||||
dlg.setWindowTitle( tr( "Expression based preview" ) );
|
dlg.setWindowTitle( tr( "Expression based preview" ) );
|
||||||
dlg.setExpressionText( mFeatureList->displayExpression() );
|
dlg.setExpressionText( mFeatureList->displayExpression() );
|
||||||
|
|
||||||
|
@ -63,7 +63,12 @@ void QgsValueRelationConfigDlg::editExpression()
|
|||||||
if ( !vl )
|
if ( !vl )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QgsExpressionBuilderDialog dlg( vl, mFilterExpression->toPlainText(), this );
|
QgsExpressionContext context;
|
||||||
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
|
<< QgsExpressionContextUtils::projectScope()
|
||||||
|
<< QgsExpressionContextUtils::layerScope( vl );
|
||||||
|
|
||||||
|
QgsExpressionBuilderDialog dlg( vl, mFilterExpression->toPlainText(), this, "generic", context );
|
||||||
dlg.setWindowTitle( tr( "Edit filter expression" ) );
|
dlg.setWindowTitle( tr( "Edit filter expression" ) );
|
||||||
|
|
||||||
if ( dlg.exec() == QDialog::Accepted )
|
if ( dlg.exec() == QDialog::Accepted )
|
||||||
|
@ -627,7 +627,12 @@ QgsRendererRulePropsDialog::~QgsRendererRulePropsDialog()
|
|||||||
|
|
||||||
void QgsRendererRulePropsDialog::buildExpression()
|
void QgsRendererRulePropsDialog::buildExpression()
|
||||||
{
|
{
|
||||||
QgsExpressionBuilderDialog dlg( mLayer, editFilter->text(), this );
|
QgsExpressionContext context;
|
||||||
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
|
<< QgsExpressionContextUtils::projectScope()
|
||||||
|
<< QgsExpressionContextUtils::layerScope( mLayer );
|
||||||
|
|
||||||
|
QgsExpressionBuilderDialog dlg( mLayer, editFilter->text(), this, "generic", context );
|
||||||
|
|
||||||
if ( dlg.exec() )
|
if ( dlg.exec() )
|
||||||
editFilter->setText( dlg.expressionText() );
|
editFilter->setText( dlg.expressionText() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user