Skip to content

Commit

Permalink
Fix for #973 : only left button activates point dialog
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9491 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Oct 18, 2008
1 parent 73c0a75 commit 53a9add
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
16 changes: 10 additions & 6 deletions src/plugins/georeferencer/mapcoordsdialog.cpp
Expand Up @@ -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() ) );
Expand Down Expand Up @@ -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 );
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/georeferencer/mapcoordsdialog.h
Expand Up @@ -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:
Expand Down
16 changes: 10 additions & 6 deletions src/plugins/georeferencer/qgspointdialog.cpp
Expand Up @@ -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 ) { }
Expand Down

0 comments on commit 53a9add

Please sign in to comment.