Skip to content
Permalink
Browse files
Fix for #973 : only left button activates point dialog
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9491 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Oct 18, 2008
1 parent e7d3f17 commit d204b2eefa49b5f2e7c2c805ee5fcb497fec9f83
Showing with 21 additions and 13 deletions.
  1. +10 −6 src/plugins/georeferencer/mapcoordsdialog.cpp
  2. +1 −1 src/plugins/georeferencer/mapcoordsdialog.h
  3. +10 −6 src/plugins/georeferencer/qgspointdialog.cpp
@@ -38,7 +38,7 @@ MapCoordsDialog::MapCoordsDialog( const QgsPoint& pixelCoords, QgsMapCanvas* qgi
mToolEmitPoint = new QgsMapToolEmitPoint( qgisCanvas );
mToolEmitPoint->setButton( btnPointFromCanvas );
connect(( QgsMapToolEmitPoint* )mToolEmitPoint, SIGNAL( gotPoint( QgsPoint&, Qt::MouseButton ) ),
this, SLOT( setXY( QgsPoint& ) ) );
this, SLOT( maybeSetXY( QgsPoint&, Qt::MouseButton ) ) );

connect( leXCoord, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateOK() ) );
connect( leYCoord, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateOK() ) );
@@ -70,12 +70,16 @@ void MapCoordsDialog::on_buttonCancel_clicked()
reject();
}

void MapCoordsDialog::setXY( QgsPoint & xy )
void MapCoordsDialog::maybeSetXY( QgsPoint & xy, Qt::MouseButton button)
{
leXCoord->clear();
leYCoord->clear();
leXCoord->insert( QString::number( xy.x(), 'f', 7 ) );
leYCoord->insert( QString::number( xy.y(), 'f', 7 ) );
// Only LeftButton should set point
if( Qt::LeftButton == button )
{
leXCoord->clear();
leYCoord->clear();
leXCoord->insert( QString::number( xy.x(), 'f', 7 ) );
leYCoord->insert( QString::number( xy.y(), 'f', 7 ) );
}

mQgisCanvas->setMapTool( mPrevMapTool );
}
@@ -35,7 +35,7 @@ class MapCoordsDialog : public QDialog, private Ui::MapCoordsDialogBase

void on_btnPointFromCanvas_clicked();

void setXY( QgsPoint & );
void maybeSetXY( QgsPoint &, Qt::MouseButton );
void updateOK();

private:
@@ -47,12 +47,16 @@ class QgsGeorefTool : public QgsMapTool
//! Mouse press event for overriding
virtual void canvasPressEvent( QMouseEvent * e )
{
QgsPoint pnt = toMapCoordinates( e->pos() );

if ( mAddPoint )
mDlg->showCoordDialog( pnt );
else
mDlg->deleteDataPoint( pnt );
// Only add point on Qt:LeftButton
if ( Qt::LeftButton == e->button() )
{
QgsPoint pnt = toMapCoordinates( e->pos() );

if ( mAddPoint )
mDlg->showCoordDialog( pnt );
else
mDlg->deleteDataPoint( pnt );
}
}

virtual void canvasMoveEvent( QMouseEvent * e ) { }

0 comments on commit d204b2e

Please sign in to comment.