Skip to content

Commit 45e45d9

Browse files
author
mhugent
committedDec 16, 2008

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ void QgisApp::createOverview()
15851585

15861586
QBitmap overviewPanBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
15871587
QBitmap overviewPanBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
1588-
mOverviewMapCursor = new QCursor( overviewPanBmp, overviewPanBmpMask, 5, 5 );
1588+
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
15891589
overviewCanvas->setCursor( *mOverviewMapCursor );
15901590
// QVBoxLayout *myOverviewLayout = new QVBoxLayout;
15911591
// myOverviewLayout->addWidget(overviewCanvas);

‎src/gui/qgsmapoverviewcanvas.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <QResizeEvent>
2828
#include <QMouseEvent>
2929
#include "qgslogger.h"
30+
#include <limits.h>
3031

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

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

150+
// allow for 5 pixel minimum widget size
151+
if ( r.width() < 5 && x1 > INT_MIN + 2 ) // make sure no underflow occurs (2 is largest adjustment)
152+
{
153+
r.setX( r.x() - ( ( 5 - r.width() ) / 2 ) ); // adjust x by 1/2 the difference of calculated and min. width
154+
r.setWidth(5);
155+
}
156+
if ( r.height() < 5 && y1 > INT_MIN + 2 )
157+
{
158+
r.setY( r.y() - ( ( 5 - r.height() ) / 2 ) ); // adjust y
159+
r.setHeight(5);
160+
}
161+
149162
QgsDebugMsg( QString( "panning: extent to widget: [%1,%2] [%3x%4]" ).arg( x1 ).arg( y1 ).arg( r.width() ).arg( r.height() ) );
150163

151164
mPanningWidget->setGeometry( r );

0 commit comments

Comments
 (0)
Please sign in to comment.