From ccc34c76e714e5f6f87d2a329ca048896eb4c87f Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Wed, 10 Jun 2020 21:25:33 +1000 Subject: [PATCH] [processing] Fix manual entry of extent values in widget Fixes #36787 --- src/gui/qgsextentwidget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/qgsextentwidget.cpp b/src/gui/qgsextentwidget.cpp index 393a99d6c1a0..2c1da8b0d491 100644 --- a/src/gui/qgsextentwidget.cpp +++ b/src/gui/qgsextentwidget.cpp @@ -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" ) ); @@ -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 ); } } }