Skip to content
Permalink
Browse files

Use the new expression builder for rule filter editing

  • Loading branch information
wonder-sk committed Jan 30, 2012
1 parent a201ae9 commit 063c7e63d707d58f66b04feae9f64b373a84cf64
@@ -173,7 +173,7 @@ void QgsAttributeActionDialog::insertExpression()
dlg.setWindowTitle( tr( "Insert expression" ) );
if ( dlg.exec() == QDialog::Accepted )
{
QString expression = dlg.expressionBuilder()->getExpressionString();
QString expression = dlg.expressionBuilder()->expressionText();
//Only add the expression if the user has entered some text.
if ( !expression.isEmpty() )
{
@@ -65,7 +65,7 @@ QgsFieldCalculator::~QgsFieldCalculator()
void QgsFieldCalculator::accept()
{

QString calcString = builder->getExpressionString();
QString calcString = builder->expressionText();
QgsExpression exp( calcString );

if ( !mVectorLayer || !mVectorLayer->isEditable() )
@@ -503,7 +503,7 @@ void QgsLabelingGui::showExpressionDialog()
dlg.setWindowTitle( tr( "Expression based label" ) );
if ( dlg.exec() == QDialog::Accepted )
{
QString expression = dlg.getExpressionText();
QString expression = dlg.expressionText();
//Only add the expression if the user has entered some text.
if ( !expression.isEmpty() )
{
@@ -25,7 +25,7 @@ QgsExpressionBuilderDialog::QgsExpressionBuilderDialog( QgsVectorLayer* layer, Q
connect( builder, SIGNAL( expressionParsed( bool ) ), okButuon, SLOT( setEnabled( bool ) ) );

builder->setLayer( layer );
builder->setExpressionString( startText );
builder->setExpressionText( startText );
builder->loadFieldNames();

QSettings settings;
@@ -37,14 +37,14 @@ QgsExpressionBuilderWidget* QgsExpressionBuilderDialog::expressionBuilder()
return builder;
}

void QgsExpressionBuilderDialog::setExpressionText( QString text )
void QgsExpressionBuilderDialog::setExpressionText( const QString& text )
{
builder->setExpressionString( text );
builder->setExpressionText( text );
}

QString QgsExpressionBuilderDialog::getExpressionText()
QString QgsExpressionBuilderDialog::expressionText()
{
return builder->getExpressionString();
return builder->expressionText();
}

void QgsExpressionBuilderDialog::closeEvent( QCloseEvent *event )
@@ -30,9 +30,9 @@ class GUI_EXPORT QgsExpressionBuilderDialog : public QDialog, private Ui::QgsExp
/** The builder widget that is used by the dialog */
QgsExpressionBuilderWidget* expressionBuilder();

void setExpressionText( QString text );
void setExpressionText( const QString& text );

QString getExpressionText();
QString expressionText();

protected:
/**
@@ -221,14 +221,14 @@ bool QgsExpressionBuilderWidget::isExpressionValid()
return mExpressionValid;
}

QString QgsExpressionBuilderWidget::getExpressionString()
QString QgsExpressionBuilderWidget::expressionText()
{
return txtExpressionString->toPlainText();
}

void QgsExpressionBuilderWidget::setExpressionString( const QString expressionString )
void QgsExpressionBuilderWidget::setExpressionText( const QString& expression )
{
txtExpressionString->setPlainText( expressionString );
txtExpressionString->setPlainText( expression );
}

void QgsExpressionBuilderWidget::on_txtExpressionString_textChanged()
@@ -124,10 +124,10 @@ class GUI_EXPORT QgsExpressionBuilderWidget : public QWidget, private Ui::QgsExp

/** Gets the expression string that has been set in the expression area.
* @returns The expression as a string. */
QString getExpressionString();
QString expressionText();

/** Sets the expression string for the widget */
void setExpressionString( const QString expressionString );
void setExpressionText( const QString& expression );

/** Registers a node item for the expression builder.
* @param group The group the item will be show in the tree view. If the group doesn't exsit it will be created.
@@ -182,7 +182,7 @@ void QgsRuleBasedRendererV2Widget::currentRuleChanged( const QModelIndex& curren
#include "qgscategorizedsymbolrendererv2widget.h"
#include "qgsgraduatedsymbolrendererv2.h"
#include "qgsgraduatedsymbolrendererv2widget.h"
#include "qgssearchquerybuilder.h"
#include "qgsexpressionbuilderdialog.h"
#include <QDialogButtonBox>
#include <QInputDialog>

@@ -416,11 +416,10 @@ QgsRendererRulePropsDialog::~QgsRendererRulePropsDialog()

void QgsRendererRulePropsDialog::buildExpression()
{
QgsSearchQueryBuilder dlg( mLayer, this );
dlg.setSearchString( editFilter->text() );
QgsExpressionBuilderDialog dlg( mLayer, editFilter->text(), this );

if ( dlg.exec() )
editFilter->setText( dlg.searchString() );
editFilter->setText( dlg.expressionText() );
}

void QgsRendererRulePropsDialog::testFilter()
@@ -434,7 +434,7 @@ void QgsWFSSourceSelect::on_treeWidget_itemDoubleClicked( QTreeWidgetItem* item,

if ( d.exec() == QDialog::Accepted )
{
item->setText( 4, w->getExpressionString() );
item->setText( 4, w->expressionText() );
}
}
}

0 comments on commit 063c7e6

Please sign in to comment.
You can’t perform that action at this time.