Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use the new expression builder for rule filter editing
  • Loading branch information
wonder-sk committed Jan 30, 2012
1 parent a201ae9 commit 063c7e6
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/app/qgsattributeactiondialog.cpp
Expand Up @@ -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() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsfieldcalculator.cpp
Expand Up @@ -65,7 +65,7 @@ QgsFieldCalculator::~QgsFieldCalculator()
void QgsFieldCalculator::accept()
{

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

if ( !mVectorLayer || !mVectorLayer->isEditable() )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgslabelinggui.cpp
Expand Up @@ -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() )
{
Expand Down
10 changes: 5 additions & 5 deletions src/gui/qgsexpressionbuilderdialog.cpp
Expand Up @@ -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;
Expand All @@ -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 )
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsexpressionbuilderdialog.h
Expand Up @@ -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:
/**
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsexpressionbuilderwidget.cpp
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsexpressionbuilderwidget.h
Expand Up @@ -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.
Expand Down
7 changes: 3 additions & 4 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Expand Up @@ -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>

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfssourceselect.cpp
Expand Up @@ -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.