From c5ff28e2ce21e3a98d550ec767484f91f5840612 Mon Sep 17 00:00:00 2001 From: timlinux Date: Fri, 7 Nov 2008 18:41:36 +0000 Subject: [PATCH] Final cleanups for gui API git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9576 c8812cc2-4d05-0410-92ff-de0c093fc19c --- python/gui/qgsmapcanvasmap.sip | 2 +- python/gui/qgsmapoverviewcanvas.sip | 2 +- python/gui/qgsmaptoolemitpoint.sip | 2 +- src/gui/qgsmapcanvas.cpp | 4 ++-- src/gui/qgsmapcanvas.h | 1 + src/gui/qgsmapcanvasmap.h | 2 +- src/gui/qgsmapoverviewcanvas.cpp | 6 +++--- src/gui/qgsmapoverviewcanvas.h | 2 +- src/gui/qgsmaptoolemitpoint.cpp | 2 +- src/gui/qgsmaptoolemitpoint.h | 6 +++--- src/plugins/georeferencer/mapcoordsdialog.cpp | 2 +- 11 files changed, 16 insertions(+), 15 deletions(-) diff --git a/python/gui/qgsmapcanvasmap.sip b/python/gui/qgsmapcanvasmap.sip index 05143f08a524..f5cc08717b7b 100644 --- a/python/gui/qgsmapcanvasmap.sip +++ b/python/gui/qgsmapcanvasmap.sip @@ -38,7 +38,7 @@ class QgsMapCanvasMap : QGraphicsRectItem //! renders map using QgsMapRender to mPixmap void render(); - void setBgColor(const QColor& color); + void setBackgroundColor(const QColor& color); void setPanningOffset(const QPoint& point); diff --git a/python/gui/qgsmapoverviewcanvas.sip b/python/gui/qgsmapoverviewcanvas.sip index 5f88c819607b..ac1778ff18fa 100644 --- a/python/gui/qgsmapoverviewcanvas.sip +++ b/python/gui/qgsmapoverviewcanvas.sip @@ -11,7 +11,7 @@ class QgsMapOverviewCanvas : QWidget ~QgsMapOverviewCanvas(); //! used for overview canvas to reflect changed extent in main map canvas - void reflectChangedExtent(); + void drawExtentRect(); //! renders overview and updates panning widget void refresh(); diff --git a/python/gui/qgsmaptoolemitpoint.sip b/python/gui/qgsmaptoolemitpoint.sip index ba29eafee28d..d0b2ea03f381 100644 --- a/python/gui/qgsmaptoolemitpoint.sip +++ b/python/gui/qgsmaptoolemitpoint.sip @@ -21,5 +21,5 @@ class QgsMapToolEmitPoint : QgsMapTool signals: //! signal emitted on canvas click - void gotPoint(QgsPoint& point, Qt::MouseButton button); + void canvasClicked(QgsPoint& point, Qt::MouseButton button); }; diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index 266789f37068..b6111a867f0b 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -463,7 +463,7 @@ void QgsMapCanvas::setExtent( QgsRect const & r ) emit extentsChanged(); updateScale(); if ( mMapOverview ) - mMapOverview->reflectChangedExtent(); + mMapOverview->drawExtentRect(); mLastExtent = current; // notify canvas items of change @@ -1000,7 +1000,7 @@ void QgsMapCanvas::unsetMapTool( QgsMapTool* tool ) void QgsMapCanvas::setCanvasColor( const QColor & theColor ) { // background of map's pixmap - mMap->setBgColor( theColor ); + mMap->setBackgroundColor( theColor ); // background of the QGraphicsView QBrush bgBrush( theColor ); diff --git a/src/gui/qgsmapcanvas.h b/src/gui/qgsmapcanvas.h index 66ede86ed727..3c0a00ac5de7 100644 --- a/src/gui/qgsmapcanvas.h +++ b/src/gui/qgsmapcanvas.h @@ -226,6 +226,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView // currently used by pan map tool //! Ends pan action and redraws the canvas. void panActionEnd( QPoint releasePoint ); + //! Called when mouse is moving and pan is activated void panAction( QMouseEvent * event ); diff --git a/src/gui/qgsmapcanvasmap.h b/src/gui/qgsmapcanvasmap.h index 04cdfad63ed6..3b4574476cd9 100644 --- a/src/gui/qgsmapcanvasmap.h +++ b/src/gui/qgsmapcanvasmap.h @@ -44,7 +44,7 @@ class GUI_EXPORT QgsMapCanvasMap : public QGraphicsRectItem //! renders map using QgsMapRenderer to mPixmap void render(); - void setBgColor( const QColor& color ) { mBgColor = color; } + void setBackgroundColor( const QColor& color ) { mBgColor = color; } void setPanningOffset( const QPoint& point ); diff --git a/src/gui/qgsmapoverviewcanvas.cpp b/src/gui/qgsmapoverviewcanvas.cpp index 3540d97b56b2..70f01c2160e5 100644 --- a/src/gui/qgsmapoverviewcanvas.cpp +++ b/src/gui/qgsmapoverviewcanvas.cpp @@ -90,7 +90,7 @@ void QgsMapOverviewCanvas::resizeEvent( QResizeEvent* e ) } -void QgsMapOverviewCanvas::reflectChangedExtent() +void QgsMapOverviewCanvas::drawExtentRect() { const QgsRect& extent = mMapCanvas->extent(); @@ -247,7 +247,7 @@ void QgsMapOverviewCanvas::refresh() update(); // update panning widget - reflectChangedExtent(); + drawExtentRect(); } @@ -269,7 +269,7 @@ void QgsMapOverviewCanvas::setLayerSet( const QStringList& layerSet ) void QgsMapOverviewCanvas::updateFullExtent( const QgsRect& rect ) { mMapRenderer->setExtent( rect ); - reflectChangedExtent(); + drawExtentRect(); } void QgsMapOverviewCanvas::hasCrsTransformEnabled( bool flag ) diff --git a/src/gui/qgsmapoverviewcanvas.h b/src/gui/qgsmapoverviewcanvas.h index 76a6bacf1bd2..520ca6cb60d1 100644 --- a/src/gui/qgsmapoverviewcanvas.h +++ b/src/gui/qgsmapoverviewcanvas.h @@ -45,7 +45,7 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget ~QgsMapOverviewCanvas(); //! used for overview canvas to reflect changed extent in main map canvas - void reflectChangedExtent(); + void drawExtentRect(); //! renders overview and updates panning widget void refresh(); diff --git a/src/gui/qgsmaptoolemitpoint.cpp b/src/gui/qgsmaptoolemitpoint.cpp index cca2377dcad3..5b63a1868e96 100644 --- a/src/gui/qgsmaptoolemitpoint.cpp +++ b/src/gui/qgsmaptoolemitpoint.cpp @@ -32,7 +32,7 @@ void QgsMapToolEmitPoint::canvasMoveEvent( QMouseEvent * e ) void QgsMapToolEmitPoint::canvasPressEvent( QMouseEvent * e ) { QgsPoint pnt = toMapCoordinates( e->pos() ); - emit gotPoint( pnt, e->button() ); + emit canvasClicked( pnt, e->button() ); } void QgsMapToolEmitPoint::canvasReleaseEvent( QMouseEvent * e ) diff --git a/src/gui/qgsmaptoolemitpoint.h b/src/gui/qgsmaptoolemitpoint.h index 1923fa051d4a..b6fbc8ecd9d5 100644 --- a/src/gui/qgsmaptoolemitpoint.h +++ b/src/gui/qgsmaptoolemitpoint.h @@ -23,8 +23,8 @@ class QgsMapCanvas; /** \ingroup gui - * A map tool that simple emits a point when clicking on the map. - * Connecting a slot to its gotPoint() signal will + * A map tool that simply emits a point when clicking on the map. + * Connecting a slot to its canvasClicked() signal will * let you implement custom behaviour for the passed in point. */ class GUI_EXPORT QgsMapToolEmitPoint : public QgsMapTool @@ -47,7 +47,7 @@ class GUI_EXPORT QgsMapToolEmitPoint : public QgsMapTool signals: //! signal emitted on canvas click - void gotPoint( QgsPoint& point, Qt::MouseButton button ); + void canvasClicked( QgsPoint& point, Qt::MouseButton button ); }; #endif diff --git a/src/plugins/georeferencer/mapcoordsdialog.cpp b/src/plugins/georeferencer/mapcoordsdialog.cpp index 751494cf6d8c..4ac1644d7c07 100644 --- a/src/plugins/georeferencer/mapcoordsdialog.cpp +++ b/src/plugins/georeferencer/mapcoordsdialog.cpp @@ -37,7 +37,7 @@ MapCoordsDialog::MapCoordsDialog( const QgsPoint& pixelCoords, QgsMapCanvas* qgi mToolEmitPoint = new QgsMapToolEmitPoint( qgisCanvas ); mToolEmitPoint->setButton( btnPointFromCanvas ); - connect(( QgsMapToolEmitPoint* )mToolEmitPoint, SIGNAL( gotPoint( QgsPoint&, Qt::MouseButton ) ), + connect(( QgsMapToolEmitPoint* )mToolEmitPoint, SIGNAL( canvasClicked( QgsPoint&, Qt::MouseButton ) ), this, SLOT( maybeSetXY( QgsPoint&, Qt::MouseButton ) ) ); connect( leXCoord, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateOK() ) );