|
14 | 14 | ***************************************************************************/
|
15 | 15 | #include "qgsquerybuilder.h"
|
16 | 16 | #include "qgslogger.h"
|
| 17 | +#include "qgsproject.h" |
17 | 18 | #include "qgssettings.h"
|
18 | 19 | #include "qgsvectorlayer.h"
|
19 | 20 | #include "qgsvectordataprovider.h"
|
@@ -243,23 +244,27 @@ void QgsQueryBuilder::test()
|
243 | 244 |
|
244 | 245 | void QgsQueryBuilder::accept()
|
245 | 246 | {
|
246 |
| - if ( !mLayer->setSubsetString( txtSQL->text() ) ) |
| 247 | + if ( txtSQL->text() != mOrigSubsetString ) |
247 | 248 | {
|
248 |
| - //error in query - show the problem |
249 |
| - if ( mLayer->dataProvider()->hasErrors() ) |
| 249 | + if ( !mLayer->setSubsetString( txtSQL->text() ) ) |
250 | 250 | {
|
251 |
| - QMessageBox::warning( this, |
252 |
| - tr( "Query Result" ), |
253 |
| - tr( "An error occurred when executing the query." ) |
254 |
| - + tr( "\nThe data provider said:\n%1" ).arg( mLayer->dataProvider()->errors().join( QStringLiteral( "\n" ) ) ) ); |
255 |
| - mLayer->dataProvider()->clearErrors(); |
256 |
| - } |
257 |
| - else |
258 |
| - { |
259 |
| - QMessageBox::warning( this, tr( "Query Result" ), tr( "Error in query. The subset string could not be set." ) ); |
| 251 | + //error in query - show the problem |
| 252 | + if ( mLayer->dataProvider()->hasErrors() ) |
| 253 | + { |
| 254 | + QMessageBox::warning( this, |
| 255 | + tr( "Query Result" ), |
| 256 | + tr( "An error occurred when executing the query." ) |
| 257 | + + tr( "\nThe data provider said:\n%1" ).arg( mLayer->dataProvider()->errors().join( QStringLiteral( "\n" ) ) ) ); |
| 258 | + mLayer->dataProvider()->clearErrors(); |
| 259 | + } |
| 260 | + else |
| 261 | + { |
| 262 | + QMessageBox::warning( this, tr( "Query Result" ), tr( "Error in query. The subset string could not be set." ) ); |
| 263 | + } |
| 264 | + |
| 265 | + return; |
260 | 266 | }
|
261 |
| - |
262 |
| - return; |
| 267 | + QgsProject::instance()->setDirty( true ); |
263 | 268 | }
|
264 | 269 |
|
265 | 270 | QDialog::accept();
|
|
0 commit comments