[QGIS Commit] r9815 - in branches/Version-1_0/src: app gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Dec 16 02:49:43 EST 2008


Author: mhugent
Date: 2008-12-16 02:49:42 -0500 (Tue, 16 Dec 2008)
New Revision: 9815

Modified:
   branches/Version-1_0/src/app/qgisapp.cpp
   branches/Version-1_0/src/gui/qgsmapoverviewcanvas.cpp
Log:
Applied patch #1323

Modified: branches/Version-1_0/src/app/qgisapp.cpp
===================================================================
--- branches/Version-1_0/src/app/qgisapp.cpp	2008-12-16 07:22:15 UTC (rev 9814)
+++ branches/Version-1_0/src/app/qgisapp.cpp	2008-12-16 07:49:42 UTC (rev 9815)
@@ -1585,7 +1585,7 @@
 
   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);

Modified: branches/Version-1_0/src/gui/qgsmapoverviewcanvas.cpp
===================================================================
--- branches/Version-1_0/src/gui/qgsmapoverviewcanvas.cpp	2008-12-16 07:22:15 UTC (rev 9814)
+++ branches/Version-1_0/src/gui/qgsmapoverviewcanvas.cpp	2008-12-16 07:49:42 UTC (rev 9815)
@@ -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 @@
 
   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 );



More information about the QGIS-commit mailing list