Skip to content

Commit

Permalink
[processing] Fix manual entry of extent values in widget
Browse files Browse the repository at this point in the history
Fixes #36787
  • Loading branch information
nyalldawson committed Jun 10, 2020
1 parent af19cea commit ccc34c7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gui/qgsextentwidget.cpp
Expand Up @@ -36,11 +36,10 @@ QgsExtentWidget::QgsExtentWidget( QWidget *parent, WidgetStyle style )
connect( mYMinLineEdit, &QLineEdit::textEdited, this, &QgsExtentWidget::setOutputExtentFromLineEdit );
connect( mYMaxLineEdit, &QLineEdit::textEdited, this, &QgsExtentWidget::setOutputExtentFromLineEdit );

mCondensedRe = QRegularExpression( QStringLiteral( "\\s*([\\d\\.]+)\\s*,\\s*([\\d\\.]+)\\s*,\\s*([\\d\\.]+)\\s*,\\s*([\\d\\.]+)\\s*(\\[.*?\\])" ) );
mCondensedRe = QRegularExpression( QStringLiteral( "\\s*([\\d\\.\\-]+)\\s*,\\s*([\\d\\.\\-]+)\\s*,\\s*([\\d\\.\\-]+)\\s*,\\s*([\\d\\.\\-]+)\\s*(?:\\[(.*?)\\])?" ) );
mCondensedLineEdit->setValidator( new QRegularExpressionValidator( mCondensedRe, this ) );
mCondensedLineEdit->setShowClearButton( false );
connect( mCondensedLineEdit, &QgsFilterLineEdit::cleared, this, &QgsExtentWidget::clear );

connect( mCondensedLineEdit, &QLineEdit::textEdited, this, &QgsExtentWidget::setOutputExtentFromCondensedLineEdit );

mLayerMenu = new QMenu( tr( "Calculate from Layer" ) );
Expand Down Expand Up @@ -246,7 +245,14 @@ void QgsExtentWidget::setOutputExtentFromCondensedLineEdit()
whileBlocking( mXMaxLineEdit )->setText( match.captured( 2 ) );
whileBlocking( mYMinLineEdit )->setText( match.captured( 3 ) );
whileBlocking( mYMaxLineEdit )->setText( match.captured( 4 ) );
if ( !match.captured( 5 ).isEmpty() )
{
mOutputCrs = QgsCoordinateReferenceSystem( match.captured( 5 ) );
}

emit extentChanged( outputExtent() );
if ( !mIsValid )
setValid( true );
}
}
}
Expand Down

0 comments on commit ccc34c7

Please sign in to comment.