Skip to content

Commit

Permalink
apply patch #1323 also to trunk
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9824 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 16, 2008
1 parent da83dc3 commit 45e45d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 13 additions & 0 deletions src/gui/qgsmapoverviewcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 45e45d9

Please sign in to comment.