Skip to content
Permalink
Browse files

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 2161c865d7355e1843aa52b640cecef6d28cc656
@@ -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 );
}
@@ -59,7 +59,7 @@ class QgsFieldCalculator: public QDialog, private Ui::QgsFieldCalculatorBase
/**idx of changed attribute*/
int mAttributeId;

bool mExpressionVaild;
bool mExpressionValid;
};

#endif // QGSFIELDCALCULATOR_H
@@ -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() ) );
}
@@ -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 );
@@ -214,9 +216,9 @@ void QgsExpressionBuilderWidget::registerItem( QString group,
}
}

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

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

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

QString QgsExpressionBuilderWidget::loadFunctionHelp( QgsExpressionItem* functionName )
@@ -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();
@@ -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
@@ -156,7 +156,6 @@
<bool>false</bool>
</property>
<zorder>mButtonBox</zorder>
<zorder>mButtonBox</zorder>
</widget>
</item>
<item row="3" column="0" colspan="2">

0 comments on commit 2161c86

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