patch_for_1323.txt

patch overview cursor/extent rectangle position - Steven Mizuno, 2008-09-20 09:30 AM

Download (1.67 KB)

 
1
Index: src/app/qgisapp.cpp
2
===================================================================
3
--- src/app/qgisapp.cpp	(revision 9334)
4
+++ src/app/qgisapp.cpp	(working copy)
5
@@ -1571,7 +1571,7 @@
6
 
7
   QBitmap overviewPanBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
8
   QBitmap overviewPanBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
9
-  mOverviewMapCursor = new QCursor( overviewPanBmp, overviewPanBmpMask, 5, 5 );
10
+  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
11
   overviewCanvas->setCursor( *mOverviewMapCursor );
12
 //  QVBoxLayout *myOverviewLayout = new QVBoxLayout;
13
 //  myOverviewLayout->addWidget(overviewCanvas);
14
Index: src/gui/qgsmapoverviewcanvas.cpp
15
===================================================================
16
--- src/gui/qgsmapoverviewcanvas.cpp	(revision 9334)
17
+++ src/gui/qgsmapoverviewcanvas.cpp	(working copy)
18
@@ -146,6 +146,18 @@
19
 
20
   QRect r( x1, y1, x2 - x1 + 1, y2 - y1 + 1 );
21
 
22
+  // allow for 5 pixel minimum widget size
23
+  if ( r.width() < 5 && x1 > INT_MIN + 2 )	// make sure no underflow occurs (2 is largest adjustment)
24
+  {
25
+    r.setX( r.x() - ( ( 5 - r.width() ) / 2 ) );	// adjust x  by 1/2 the difference of calculated and min. width
26
+    r.setWidth(5);
27
+  }
28
+  if ( r.height() < 5 && y1 > INT_MIN + 2 ) 
29
+  {
30
+    r.setY( r.y() - ( ( 5 - r.height() ) / 2 ) );	// adjust y
31
+    r.setHeight(5); 
32
+  }
33
+
34
   QgsDebugMsg( QString( "panning: extent to widget: [%1,%2] [%3x%4]" ).arg( x1 ).arg( y1 ).arg( r.width() ).arg( r.height() ) );
35
 
36
   mPanningWidget->setGeometry( r );