From a17488239fdb620daafd6c72f31e20797df0f622 Mon Sep 17 00:00:00 2001 From: jef Date: Wed, 2 Sep 2009 22:41:43 +0000 Subject: [PATCH] fix python plugin crashes - changes GUI API - QgsMapCanvas::xyCoordinates(QgsPoint & p) => xyCoordinates(const QgsPoint & p) - QgsMapToolEmitPoint::canvasClicked(QgsPoint& point, Qt::MouseButton button) => canvasClicked( const QgsPoint& point, Qt::MouseButton button) - might be a SIP 4.8 problem git-svn-id: http://svn.osgeo.org/qgis/trunk@11540 c8812cc2-4d05-0410-92ff-de0c093fc19c --- python/gui/qgsmapcanvas.sip | 6 ++++-- python/gui/qgsmaptoolemitpoint.sip | 4 ++-- src/app/qgisapp.cpp | 4 ++-- src/app/qgisapp.h | 2 +- src/gui/qgsmapcanvas.h | 6 ++++-- src/gui/qgsmaptoolemitpoint.h | 3 ++- src/plugins/georeferencer/mapcoordsdialog.cpp | 6 +++--- src/plugins/georeferencer/mapcoordsdialog.h | 2 +- 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/python/gui/qgsmapcanvas.sip b/python/gui/qgsmapcanvas.sip index 3475bb3ab4f..064ff34a573 100644 --- a/python/gui/qgsmapcanvas.sip +++ b/python/gui/qgsmapcanvas.sip @@ -224,8 +224,10 @@ class QgsMapCanvas : QGraphicsView signals: /** Let the owner know how far we are with render operations */ void setProgress(int,int); - /** emits current mouse position */ - void xyCoordinates(QgsPoint & p); + + /** emits current mouse position + \note changed in 1.3 */ + void xyCoordinates(const QgsPoint &p); //! Emitted when the scale of the map changes void scaleChanged(QString); diff --git a/python/gui/qgsmaptoolemitpoint.sip b/python/gui/qgsmaptoolemitpoint.sip index d0b2ea03f38..76613c52931 100644 --- a/python/gui/qgsmaptoolemitpoint.sip +++ b/python/gui/qgsmaptoolemitpoint.sip @@ -19,7 +19,7 @@ class QgsMapToolEmitPoint : QgsMapTool virtual void canvasReleaseEvent(QMouseEvent * e); signals: - //! signal emitted on canvas click - void canvasClicked(QgsPoint& point, Qt::MouseButton button); + // \note changed in 1.3 + void canvasClicked( const QgsPoint &point, Qt::MouseButton button); }; diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index a3e6a34e937..97727ee9a79 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -1680,7 +1680,7 @@ void QgisApp::setupConnections() mMapTools.mNodeTool, SLOT( currentLayerChanged( QgsMapLayer* ) ) ); //signal when mouse moved over window (coords display in status bar) - connect( mMapCanvas, SIGNAL( xyCoordinates( QgsPoint & ) ), this, SLOT( showMouseCoordinate( QgsPoint & ) ) ); + connect( mMapCanvas, SIGNAL( xyCoordinates( const QgsPoint & ) ), this, SLOT( showMouseCoordinate( const QgsPoint & ) ) ); connect( mMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) ); connect( mMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( hasCrsTransformEnabled( bool ) ) ); connect( mMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( destinationSrsChanged() ) ); @@ -4641,7 +4641,7 @@ void QgisApp::toggleEditing( QgsMapLayer *layer ) vlayer->triggerRepaint(); } -void QgisApp::showMouseCoordinate( QgsPoint & p ) +void QgisApp::showMouseCoordinate( const QgsPoint & p ) { if ( mMapTipsVisible ) { diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index 7df5a5db551..3381b72fcc2 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -394,7 +394,7 @@ class QgisApp : public QMainWindow /** toggles whether the current selected layer is in overview or not */ void isInOverview(); //! Slot to show the map coordinate position of the mouse cursor - void showMouseCoordinate( QgsPoint & ); + void showMouseCoordinate( const QgsPoint & ); //! Slot to show current map scale; void showScale( double theScale ); //! Slot to handle user scale input; diff --git a/src/gui/qgsmapcanvas.h b/src/gui/qgsmapcanvas.h index bb6e8469bcf..744a047dcbf 100644 --- a/src/gui/qgsmapcanvas.h +++ b/src/gui/qgsmapcanvas.h @@ -285,8 +285,10 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView signals: /** Let the owner know how far we are with render operations */ void setProgress( int, int ); - /** emits current mouse position */ - void xyCoordinates( QgsPoint & p ); + + /** emits current mouse position + \note changed in 1.3 */ + void xyCoordinates( const QgsPoint & p ); //! Emitted when the scale of the map changes void scaleChanged( double ); diff --git a/src/gui/qgsmaptoolemitpoint.h b/src/gui/qgsmaptoolemitpoint.h index b6fbc8ecd9d..7221ebd4592 100644 --- a/src/gui/qgsmaptoolemitpoint.h +++ b/src/gui/qgsmaptoolemitpoint.h @@ -47,7 +47,8 @@ class GUI_EXPORT QgsMapToolEmitPoint : public QgsMapTool signals: //! signal emitted on canvas click - void canvasClicked( QgsPoint& point, Qt::MouseButton button ); + // \note changed in 1.3 + void canvasClicked( const QgsPoint& point, Qt::MouseButton button ); }; #endif diff --git a/src/plugins/georeferencer/mapcoordsdialog.cpp b/src/plugins/georeferencer/mapcoordsdialog.cpp index beca0e8d3fa..bec5d506611 100644 --- a/src/plugins/georeferencer/mapcoordsdialog.cpp +++ b/src/plugins/georeferencer/mapcoordsdialog.cpp @@ -40,8 +40,8 @@ MapCoordsDialog::MapCoordsDialog( const QgsPoint& pixelCoords, QgsMapCanvas* qgi mToolEmitPoint = new QgsMapToolEmitPoint( qgisCanvas ); mToolEmitPoint->setButton( btnPointFromCanvas ); - connect(( QgsMapToolEmitPoint* )mToolEmitPoint, SIGNAL( canvasClicked( QgsPoint&, Qt::MouseButton ) ), - this, SLOT( maybeSetXY( QgsPoint&, Qt::MouseButton ) ) ); + connect(( QgsMapToolEmitPoint* )mToolEmitPoint, SIGNAL( canvasClicked( const QgsPoint&, Qt::MouseButton ) ), + this, SLOT( maybeSetXY( const QgsPoint&, Qt::MouseButton ) ) ); connect( leXCoord, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateOK() ) ); connect( leYCoord, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateOK() ) ); @@ -73,7 +73,7 @@ void MapCoordsDialog::on_buttonCancel_clicked() reject(); } -void MapCoordsDialog::maybeSetXY( QgsPoint & xy, Qt::MouseButton button ) +void MapCoordsDialog::maybeSetXY( const QgsPoint & xy, Qt::MouseButton button ) { // Only LeftButton should set point if ( Qt::LeftButton == button ) diff --git a/src/plugins/georeferencer/mapcoordsdialog.h b/src/plugins/georeferencer/mapcoordsdialog.h index 3b13cebaa49..db9cd6467c2 100644 --- a/src/plugins/georeferencer/mapcoordsdialog.h +++ b/src/plugins/georeferencer/mapcoordsdialog.h @@ -35,7 +35,7 @@ class MapCoordsDialog : public QDialog, private Ui::MapCoordsDialogBase void on_btnPointFromCanvas_clicked(); - void maybeSetXY( QgsPoint &, Qt::MouseButton ); + void maybeSetXY( const QgsPoint &, Qt::MouseButton ); void updateOK(); private: