Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
expression builder: fix typos and warnings and follow selection (not …
…just clicked)
  • Loading branch information
jef-n committed Jan 18, 2012
1 parent a3452a5 commit 2161c86
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
9 changes: 2 additions & 7 deletions src/app/qgsfieldcalculator.cpp
Expand Up @@ -269,12 +269,7 @@ void QgsFieldCalculator::populateFields()

void QgsFieldCalculator::setOkButtonState()
{
bool okEnabled = true;
if (( mOutputFieldNameLineEdit->text().isEmpty()
&& !mUpdateExistingGroupBox->isChecked()
|| !builder->isExpressionVaild() ) )
{
okEnabled = false;
}
bool okEnabled = ( !mOutputFieldNameLineEdit->text().isEmpty() || mUpdateExistingGroupBox->isChecked() ) && builder->isExpressionValid();

mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( okEnabled );
}
2 changes: 1 addition & 1 deletion src/app/qgsfieldcalculator.h
Expand Up @@ -59,7 +59,7 @@ class QgsFieldCalculator: public QDialog, private Ui::QgsFieldCalculatorBase
/**idx of changed attribute*/
int mAttributeId;

bool mExpressionVaild;
bool mExpressionValid;
};

#endif // QGSFIELDCALCULATOR_H
14 changes: 8 additions & 6 deletions src/gui/qgsexpressionbuilderwidget.cpp
Expand Up @@ -41,10 +41,12 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )
expressionTree->setModel( mProxyModel );

expressionTree->setContextMenuPolicy( Qt::CustomContextMenu );
connect( this, SIGNAL( expressionParsed( bool ) ), this, SLOT( setExpressionState ) );
connect( this, SIGNAL( expressionParsed( bool ) ), this, SLOT( setExpressionState( bool ) ) );
connect( expressionTree, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) );
connect( expressionTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ),
this, SLOT( currentChanged( const QModelIndex &, const QModelIndex & ) ) );

foreach( QPushButton* button, this->mOperatorsGroupBox->findChildren<QPushButton *>() )
foreach( QPushButton* button, mOperatorsGroupBox->findChildren<QPushButton *>() )
{
connect( button, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
}
Expand Down Expand Up @@ -99,7 +101,7 @@ void QgsExpressionBuilderWidget::setLayer( QgsVectorLayer *layer )
mLayer = layer;
}

void QgsExpressionBuilderWidget::on_expressionTree_clicked( const QModelIndex &index )
void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const QModelIndex & )
{
// Get the item
QModelIndex idx = mProxyModel->mapToSource( index );
Expand Down Expand Up @@ -214,9 +216,9 @@ void QgsExpressionBuilderWidget::registerItem( QString group,
}
}

bool QgsExpressionBuilderWidget::isExpressionVaild()
bool QgsExpressionBuilderWidget::isExpressionValid()
{
return mExpressionVaild;
return mExpressionValid;
}

QString QgsExpressionBuilderWidget::getExpressionString()
Expand Down Expand Up @@ -370,7 +372,7 @@ void QgsExpressionBuilderWidget::loadAllValues()

void QgsExpressionBuilderWidget::setExpressionState( bool state )
{
mExpressionVaild = state;
mExpressionValid = state;
}

QString QgsExpressionBuilderWidget::loadFunctionHelp( QgsExpressionItem* functionName )
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsexpressionbuilderwidget.h
Expand Up @@ -140,10 +140,10 @@ class GUI_EXPORT QgsExpressionBuilderWidget : public QWidget, private Ui::QgsExp
QString helpText = "",
QgsExpressionItem::ItemType type = QgsExpressionItem::ExpressionNode );

bool isExpressionVaild();
bool isExpressionValid();

public slots:
void on_expressionTree_clicked( const QModelIndex &index );
void currentChanged( const QModelIndex &index, const QModelIndex & );
void on_expressionTree_doubleClicked( const QModelIndex &index );
void on_txtExpressionString_textChanged();
void on_txtSearchEdit_textChanged();
Expand Down Expand Up @@ -175,7 +175,7 @@ class GUI_EXPORT QgsExpressionBuilderWidget : public QWidget, private Ui::QgsExp
QMap<QString, QgsExpressionItem*> mExpressionGroups;
QgsFeature mFeature;
QgsExpressionHighlighter* highlighter;
bool mExpressionVaild;
bool mExpressionValid;
};

#endif // QGSEXPRESSIONBUILDER_H
1 change: 0 additions & 1 deletion src/ui/qgsfieldcalculatorbase.ui
Expand Up @@ -156,7 +156,6 @@
<bool>false</bool>
</property>
<zorder>mButtonBox</zorder>
<zorder>mButtonBox</zorder>
</widget>
</item>
<item row="3" column="0" colspan="2">
Expand Down

0 comments on commit 2161c86

Please sign in to comment.