~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/gui/qgsmaptoolpan.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "qgscursors.h"
20
20
#include <QBitmap>
21
21
#include <QCursor>
22
 
 
23
 
 
24
 
QgsMapToolPan::QgsMapToolPan(QgsMapCanvas* canvas)
25
 
  : QgsMapTool(canvas), mDragging(FALSE)
 
22
#include <QMouseEvent>
 
23
 
 
24
 
 
25
QgsMapToolPan::QgsMapToolPan( QgsMapCanvas* canvas )
 
26
    : QgsMapTool( canvas ), mDragging( FALSE )
26
27
{
27
28
  // set cursor
28
 
  QBitmap panBmp(16, 16, pan_bits, true);
29
 
  QBitmap panBmpMask(16, 16, pan_mask_bits, true);
30
 
  mCursor = QCursor(panBmp, panBmpMask, 5, 5);
 
29
  QBitmap panBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
 
30
  QBitmap panBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
 
31
  mCursor = QCursor( panBmp, panBmpMask, 5, 5 );
31
32
}
32
33
 
33
 
    
34
 
void QgsMapToolPan::canvasMoveEvent(QMouseEvent * e)
 
34
 
 
35
void QgsMapToolPan::canvasMoveEvent( QMouseEvent * e )
35
36
{
36
 
  if (mDragging && (e->buttons() & Qt::LeftButton))
 
37
  if ( mDragging && ( e->buttons() & Qt::LeftButton ) )
37
38
  {
38
39
    // move map and other canvas items
39
 
    mCanvas->panAction(e);
 
40
    mCanvas->panAction( e );
40
41
  }
41
42
}
42
 
  
43
 
    
44
 
void QgsMapToolPan::canvasPressEvent(QMouseEvent * e)
 
43
 
 
44
 
 
45
void QgsMapToolPan::canvasPressEvent( QMouseEvent * e )
45
46
{
46
 
  if (e->button() == Qt::LeftButton)
 
47
  if ( e->button() == Qt::LeftButton )
47
48
  {
48
49
    mDragging = TRUE;
49
50
  }
50
51
}
51
 
  
52
 
    
53
 
void QgsMapToolPan::canvasReleaseEvent(QMouseEvent * e)
 
52
 
 
53
 
 
54
void QgsMapToolPan::canvasReleaseEvent( QMouseEvent * e )
54
55
{
55
 
  if (mDragging && e->button() == Qt::LeftButton)
 
56
  if ( mDragging && e->button() == Qt::LeftButton )
56
57
  {
57
 
    mCanvas->panActionEnd(e->pos());
 
58
    mCanvas->panActionEnd( e->pos() );
58
59
    mDragging = FALSE;
59
60
  }
60
61
}