Skip to content

Commit

Permalink
fix python plugin crashes - changes GUI API
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
jef committed Sep 2, 2009
1 parent 6bea923 commit a174882
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
6 changes: 4 additions & 2 deletions python/gui/qgsmapcanvas.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions python/gui/qgsmaptoolemitpoint.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
4 changes: 2 additions & 2 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) );
Expand Down Expand Up @@ -4641,7 +4641,7 @@ void QgisApp::toggleEditing( QgsMapLayer *layer )
vlayer->triggerRepaint();
}

void QgisApp::showMouseCoordinate( QgsPoint & p )
void QgisApp::showMouseCoordinate( const QgsPoint & p )
{
if ( mMapTipsVisible )
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsmaptoolemitpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/plugins/georeferencer/mapcoordsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) );
Expand Down Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/georeferencer/mapcoordsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a174882

Please sign in to comment.