Skip to content
Permalink
Browse files
Applied patch #1323
git-svn-id: http://svn.osgeo.org/qgis/branches/Version-1_0@9815 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 16, 2008
1 parent 0fb8a4e commit c3d8756b8f59b81f5f28a860b5512ca6881d2ec0
Showing with 14 additions and 1 deletion.
  1. +1 −1 src/app/qgisapp.cpp
  2. +13 −0 src/gui/qgsmapoverviewcanvas.cpp
@@ -1585,7 +1585,7 @@ void QgisApp::createOverview()

QBitmap overviewPanBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
QBitmap overviewPanBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
mOverviewMapCursor = new QCursor( overviewPanBmp, overviewPanBmpMask, 5, 5 );
mOverviewMapCursor = new QCursor( overviewPanBmp, overviewPanBmpMask, 0, 0 ); //set upper left corner as hot spot - this is better when extent marker is small; hand won't cover the marker
overviewCanvas->setCursor( *mOverviewMapCursor );
// QVBoxLayout *myOverviewLayout = new QVBoxLayout;
// myOverviewLayout->addWidget(overviewCanvas);
@@ -27,6 +27,7 @@
#include <QResizeEvent>
#include <QMouseEvent>
#include "qgslogger.h"
#include <limits.h>

//! widget that serves as rectangle showing current extent in overview
class QgsPanningWidget : public QWidget
@@ -146,6 +147,18 @@ void QgsMapOverviewCanvas::drawExtentRect()

QRect r( x1, y1, x2 - x1 + 1, y2 - y1 + 1 );

// allow for 5 pixel minimum widget size
if ( r.width() < 5 && x1 > INT_MIN + 2 ) // make sure no underflow occurs (2 is largest adjustment)
{
r.setX( r.x() - ( ( 5 - r.width() ) / 2 ) ); // adjust x by 1/2 the difference of calculated and min. width
r.setWidth(5);
}
if ( r.height() < 5 && y1 > INT_MIN + 2 )
{
r.setY( r.y() - ( ( 5 - r.height() ) / 2 ) ); // adjust y
r.setHeight(5);
}

QgsDebugMsg( QString( "panning: extent to widget: [%1,%2] [%3x%4]" ).arg( x1 ).arg( y1 ).arg( r.width() ).arg( r.height() ) );

mPanningWidget->setGeometry( r );

0 comments on commit c3d8756

Please sign in to comment.