Skip to content

Commit d204b2e

Browse files
author
homann
committed
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
1 parent e7d3f17 commit d204b2e

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

src/plugins/georeferencer/mapcoordsdialog.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ MapCoordsDialog::MapCoordsDialog( const QgsPoint& pixelCoords, QgsMapCanvas* qgi
3838
mToolEmitPoint = new QgsMapToolEmitPoint( qgisCanvas );
3939
mToolEmitPoint->setButton( btnPointFromCanvas );
4040
connect(( QgsMapToolEmitPoint* )mToolEmitPoint, SIGNAL( gotPoint( QgsPoint&, Qt::MouseButton ) ),
41-
this, SLOT( setXY( QgsPoint& ) ) );
41+
this, SLOT( maybeSetXY( QgsPoint&, Qt::MouseButton ) ) );
4242

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

73-
void MapCoordsDialog::setXY( QgsPoint & xy )
73+
void MapCoordsDialog::maybeSetXY( QgsPoint & xy, Qt::MouseButton button)
7474
{
75-
leXCoord->clear();
76-
leYCoord->clear();
77-
leXCoord->insert( QString::number( xy.x(), 'f', 7 ) );
78-
leYCoord->insert( QString::number( xy.y(), 'f', 7 ) );
75+
// Only LeftButton should set point
76+
if( Qt::LeftButton == button )
77+
{
78+
leXCoord->clear();
79+
leYCoord->clear();
80+
leXCoord->insert( QString::number( xy.x(), 'f', 7 ) );
81+
leYCoord->insert( QString::number( xy.y(), 'f', 7 ) );
82+
}
7983

8084
mQgisCanvas->setMapTool( mPrevMapTool );
8185
}

src/plugins/georeferencer/mapcoordsdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MapCoordsDialog : public QDialog, private Ui::MapCoordsDialogBase
3535

3636
void on_btnPointFromCanvas_clicked();
3737

38-
void setXY( QgsPoint & );
38+
void maybeSetXY( QgsPoint &, Qt::MouseButton );
3939
void updateOK();
4040

4141
private:

src/plugins/georeferencer/qgspointdialog.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ class QgsGeorefTool : public QgsMapTool
4747
//! Mouse press event for overriding
4848
virtual void canvasPressEvent( QMouseEvent * e )
4949
{
50-
QgsPoint pnt = toMapCoordinates( e->pos() );
51-
52-
if ( mAddPoint )
53-
mDlg->showCoordDialog( pnt );
54-
else
55-
mDlg->deleteDataPoint( pnt );
50+
// Only add point on Qt:LeftButton
51+
if ( Qt::LeftButton == e->button() )
52+
{
53+
QgsPoint pnt = toMapCoordinates( e->pos() );
54+
55+
if ( mAddPoint )
56+
mDlg->showCoordDialog( pnt );
57+
else
58+
mDlg->deleteDataPoint( pnt );
59+
}
5660
}
5761

5862
virtual void canvasMoveEvent( QMouseEvent * e ) { }

0 commit comments

Comments
 (0)