Skip to content
Permalink
Browse files

Use window system provided cursors rather than bitmaps

  • Loading branch information
m-kuhn committed Nov 24, 2015
1 parent afd436d commit 3624d7b4d818628b7d7d446ff642f5be1cc16773
Showing with 14 additions and 8 deletions.
  1. +1 −3 src/app/qgisapp.cpp
  2. +2 −2 src/gui/qgscursors.h
  3. +8 −3 src/gui/qgsmaptoolpan.cpp
  4. +3 −0 src/gui/qgsmaptoolpan.h
@@ -2484,9 +2484,7 @@ void QgisApp::createOverview()

mOverviewCanvas->setWhatsThis( tr( "Map overview canvas. This canvas can be used to display a locator map that shows the current extent of the map canvas. The current extent is shown as a red rectangle. Any layer on the map can be added to the overview canvas." ) );

QBitmap overviewPanBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
QBitmap overviewPanBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
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
mOverviewMapCursor = new QCursor( Qt::OpenHandCursor );
mOverviewCanvas->setCursor( *mOverviewMapCursor );
// QVBoxLayout *myOverviewLayout = new QVBoxLayout;
// myOverviewLayout->addWidget(overviewCanvas);
@@ -24,8 +24,8 @@
extern GUI_EXPORT const char *zoom_in[];
extern GUI_EXPORT const char *zoom_out[];

extern GUI_EXPORT const unsigned char pan_bits[];
extern GUI_EXPORT const unsigned char pan_mask_bits[];
extern GUI_EXPORT const unsigned char pan_bits[]; // TODO QGIS3: Removeme
extern GUI_EXPORT const unsigned char pan_mask_bits[]; // TODO QGIS3: Removeme

extern GUI_EXPORT const char *capture_point_cursor[];
extern GUI_EXPORT const char *select_cursor[];
@@ -28,9 +28,13 @@ QgsMapToolPan::QgsMapToolPan( QgsMapCanvas* canvas )
{
mToolName = tr( "Pan" );
// set cursor
QBitmap panBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
QBitmap panBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
mCursor = QCursor( panBmp, panBmpMask, 5, 5 );
mCursor = QCursor( Qt::OpenHandCursor );
}

void QgsMapToolPan::canvasPressEvent( QgsMapMouseEvent* e )
{
if ( e->button() == Qt::LeftButton )
mCanvas->setCursor( QCursor( Qt::ClosedHandCursor ) );
}


@@ -61,4 +65,5 @@ void QgsMapToolPan::canvasReleaseEvent( QgsMapMouseEvent* e )
mCanvas->refresh();
}
}
mCanvas->setCursor( mCursor );
}
@@ -32,6 +32,9 @@ class GUI_EXPORT QgsMapToolPan : public QgsMapTool
//! constructor
QgsMapToolPan( QgsMapCanvas* canvas );

//! Mouse press event
virtual void canvasPressEvent( QgsMapMouseEvent* e ) override;

//! Overridden mouse move event
virtual void canvasMoveEvent( QgsMapMouseEvent* e ) override;

0 comments on commit 3624d7b

Please sign in to comment.
You can’t perform that action at this time.