bug4734.patch

Suppress undesired canvas re-centering. - Bill Clay, 2012-01-02 04:15 AM

Download (1.89 KB)

View differences:

src/app/qgisapp.cpp
1279 1279
  mCoordsEdit->setToolTip( tr( "Current map coordinate (formatted as x,y)" ) );
1280 1280
  statusBar()->addPermanentWidget( mCoordsEdit, 0 );
1281 1281
  connect( mCoordsEdit, SIGNAL( editingFinished() ), this, SLOT( userCenter() ) );
1282

  
1282
  connect( mCoordsEdit, SIGNAL( textEdited( QString ) ), this, SLOT( userCenterEdit() ) );
1283
  
1283 1284
  // add a label to show current scale
1284 1285
  mScaleLabel = new QLabel( QString(), statusBar() );
1285 1286
  mScaleLabel->setObjectName( "mScaleLable" );
......
4421 4422
  }
4422 4423
}
4423 4424

  
4425
void QgisApp::userCenterEdit()
4426
{
4427
  //QgisApp updates coordinates continually; note if user changes them explicitly
4428
  mCoordsEdit->setProperty( "edited", true );
4429
}
4430

  
4424 4431
void QgisApp::userCenter()
4425 4432
{
4433
  //[issue 4734] if focus remains in mCoordsEdit, mouse clicks elsewhere call userCenter()
4434
  mCoordsEdit->clearFocus();
4435
  if ( ! mCoordsEdit->property( "edited" ).isValid() )
4436
    //user placed cursor in coordinates field, but did not enter a new value; do not move canvas
4437
    return;
4438
  mCoordsEdit->setProperty( "edited", QVariant() );  //remove property "edited"
4439
  
4426 4440
  QStringList parts = mCoordsEdit->text().split( ',' );
4427 4441
  if ( parts.size() != 2 )
4428 4442
    return;
src/app/qgisapp.h
496 496
    void showScale( double theScale );
497 497
    //! Slot to handle user scale input;
498 498
    void userScale();
499
    //! Slot to handle user center input;
499
    //! Slots to handle user center input;
500 500
    void userCenter();
501
    void userCenterEdit();
501 502
    //! Remove a layer from the map and legend
502 503
    void removeLayer();
503 504
    //! Set CRS of a layer