Skip to content

Commit

Permalink
Disable return to run field calc til 2.6. Disable button on invalid e…
Browse files Browse the repository at this point in the history
…xpression
  • Loading branch information
NathanW2 committed Jun 19, 2014
1 parent 0ce4cbf commit 0defbeb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/gui/qgsfieldexpressionwidget.sip
Expand Up @@ -56,7 +56,7 @@ class QgsFieldExpressionWidget : QWidget
//! fieldChanged signal with indication of the validity of the expression
void fieldChanged( QString fieldName, bool isValid );

void returnPressed();
// void returnPressed();

public slots:
//! set the layer used to display the fields and expression
Expand Down
9 changes: 8 additions & 1 deletion src/app/qgsattributetabledialog.cpp
Expand Up @@ -205,7 +205,9 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
mFieldModel->setLayer( mLayer );
mFieldCombo->setModel( mFieldModel );
connect( mRunFieldCalc, SIGNAL( clicked() ), this, SLOT( updateFieldFromExpression() ) );
connect( mUpdateExpressionText, SIGNAL( returnPressed() ), this, SLOT( updateFieldFromExpression() ) );
// NW TODO Fix in 2.6 - Doesn't work with field model for some reason.
// connect( mUpdateExpressionText, SIGNAL( returnPressed() ), this, SLOT( updateFieldFromExpression() ) );
connect( mUpdateExpressionText, SIGNAL( fieldChanged( QString , bool ) ), this, SLOT( updateButtonStatus( QString, bool ) ) );
mUpdateExpressionText->setLayer( mLayer );
mUpdateExpressionText->setLeftHandButtonStyle( true );
editingToggled();
Expand All @@ -232,6 +234,11 @@ void QgsAttributeTableDialog::updateTitle()
mRunFieldCalc->setText( tr( "Update Filtered" ) );
}

void QgsAttributeTableDialog::updateButtonStatus( QString fieldName, bool isValid )
{
mRunFieldCalc->setEnabled( isValid );
}

void QgsAttributeTableDialog::closeEvent( QCloseEvent* event )
{
QDialog::closeEvent( event );
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsattributetabledialog.h
Expand Up @@ -153,6 +153,7 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
*/
void updateTitle();

void updateButtonStatus( QString fieldName, bool isValid );
signals:
/**
* Informs that editing mode has been toggled
Expand Down
4 changes: 3 additions & 1 deletion src/gui/qgsfieldexpressionwidget.cpp
Expand Up @@ -52,7 +52,8 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
connect( mCombo->lineEdit(), SIGNAL( editingFinished() ), this, SLOT( expressionEditingFinished() ) );
connect( mCombo, SIGNAL( activated( int ) ), this, SLOT( currentFieldChanged() ) );
connect( mButton, SIGNAL( clicked() ), this, SLOT( editExpression() ) );
connect( mCombo->lineEdit(), SIGNAL( returnPressed() ), this, SIGNAL( returnPressed() ) );
// NW TODO - Fix in 2.6
// connect( mCombo->lineEdit(), SIGNAL( returnPressed() ), this, SIGNAL( returnPressed() ) );
}

void QgsFieldExpressionWidget::setExpressionDialogTitle( QString title )
Expand Down Expand Up @@ -181,6 +182,7 @@ void QgsFieldExpressionWidget::editExpression()
void QgsFieldExpressionWidget::expressionEdited( const QString expression )
{
updateLineEditStyle( expression );
emit fieldChanged( expression, isValidExpression());
}

void QgsFieldExpressionWidget::expressionEditingFinished()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsfieldexpressionwidget.h
Expand Up @@ -95,7 +95,7 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
//! fieldChanged signal with indication of the validity of the expression
void fieldChanged( QString fieldName, bool isValid );

void returnPressed();
// void returnPressed();

public slots:
//! set the layer used to display the fields and expression
Expand Down

0 comments on commit 0defbeb

Please sign in to comment.