[QGIS Commit] r9491 - trunk/qgis/src/plugins/georeferencer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Oct 18 14:31:32 EDT 2008


Author: homann
Date: 2008-10-18 14:31:32 -0400 (Sat, 18 Oct 2008)
New Revision: 9491

Modified:
   trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.cpp
   trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.h
   trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp
Log:
Fix for #973 : only left button activates point dialog

Modified: trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.cpp	2008-10-17 13:29:17 UTC (rev 9490)
+++ trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.cpp	2008-10-18 18:31:32 UTC (rev 9491)
@@ -38,7 +38,7 @@
   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 @@
   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 );
 }

Modified: trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.h
===================================================================
--- trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.h	2008-10-17 13:29:17 UTC (rev 9490)
+++ trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.h	2008-10-18 18:31:32 UTC (rev 9491)
@@ -35,7 +35,7 @@
 
     void on_btnPointFromCanvas_clicked();
 
-    void setXY( QgsPoint & );
+    void maybeSetXY( QgsPoint &, Qt::MouseButton );
     void updateOK();
 
   private:

Modified: trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp	2008-10-17 13:29:17 UTC (rev 9490)
+++ trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp	2008-10-18 18:31:32 UTC (rev 9491)
@@ -47,12 +47,16 @@
     //! Mouse press event for overriding
     virtual void canvasPressEvent( QMouseEvent * e )
     {
-      QgsPoint pnt = toMapCoordinates( e->pos() );
+      // 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 );
+	if ( mAddPoint )
+	  mDlg->showCoordDialog( pnt );
+	else
+	  mDlg->deleteDataPoint( pnt );
+      }
     }
 
     virtual void canvasMoveEvent( QMouseEvent * e ) { }



More information about the QGIS-commit mailing list