Skip to content
Permalink
Browse files

Revert "[FEATURE] Pan composer with middle mouse button"

This reverts commit 9bc8c80.
  • Loading branch information
mhugent committed Sep 23, 2013
1 parent 8a94505 commit f7585979b03ba72d7bdadc705ac87b63f649a349
Showing with 8 additions and 77 deletions.
  1. +0 −7 src/core/composer/qgscomposeritem.cpp
  2. +8 −67 src/gui/qgscomposerview.cpp
  3. +0 −3 src/gui/qgscomposerview.h
@@ -924,13 +924,6 @@ void QgsComposerItem::setEffectsEnabled( bool effectsEnabled )

void QgsComposerItem::hoverMoveEvent( QGraphicsSceneHoverEvent * event )
{
if ( QgsApplication::mouseButtons() == Qt::MidButton )
{
//middle mouse button panning, make sure we use the closed hand cursor
setCursor( Qt::ClosedHandCursor );
return;
}

if ( isSelected() )
{
setCursor( cursorForPosition( event->pos() ) );
@@ -48,7 +48,6 @@ QgsComposerView::QgsComposerView( QWidget* parent, const char* name, Qt::WFlags
, mPaintingEnabled( true )
, mHorizontalRuler( 0 )
, mVerticalRuler( 0 )
, mPanning( false )
{
Q_UNUSED( f );
Q_UNUSED( name );
@@ -84,15 +83,6 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )
}
return;
}
else if ( e->button() == Qt::MidButton )
{
//pan composer with middle button
mPanning = true;
mMouseLastXY = e->pos();
setCursor( Qt::ClosedHandCursor );
e->accept();
return;
}

switch ( mCurrentTool )
{
@@ -320,15 +310,6 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e )

QPointF scenePoint = mapToScene( e->pos() );

if ( mPanning )
{
//panning with middle button
mPanning = false;
setCursor( Qt::ArrowCursor );
e->accept();
return;
}

switch ( mCurrentTool )
{
case Select:
@@ -449,15 +430,6 @@ void QgsComposerView::mouseMoveEvent( QMouseEvent* e )
QGraphicsView::mouseMoveEvent( e );
}
}
else if ( mPanning )
{
//panning with middle mouse button, scroll view
horizontalScrollBar()->setValue( horizontalScrollBar()->value() - ( e->x() - mMouseLastXY.x() ) );
verticalScrollBar()->setValue( verticalScrollBar()->value() - ( e->y() - mMouseLastXY.y() ) );
mMouseLastXY = e->pos();
e->accept();
return;
}
else
{
QPointF scenePoint = mapToScene( e->pos() );
@@ -785,47 +757,16 @@ void QgsComposerView::wheelEvent( QWheelEvent* event )
{
QPointF scenePoint = mapToScene( event->pos() );

if ( currentTool() == MoveItemContent )
//select topmost item at position of event
QgsComposerItem* theItem = composition()->composerItemAt( scenePoint );
if ( theItem )
{
//move item content tool, so scroll events get handled by the composer item

//select topmost item at position of event
QgsComposerItem* theItem = composition()->composerItemAt( scenePoint );
if ( theItem )
if ( theItem->isSelected() )
{
if ( theItem->isSelected() )
{
QPointF itemPoint = theItem->mapFromScene( scenePoint );
theItem->beginCommand( tr( "Zoom item content" ) );
theItem->zoomContent( event->delta(), itemPoint.x(), itemPoint.y() );
theItem->endCommand();
}
}
}
else
{
//zoom whole composition
if ( event->delta() > 0 )
{
scale( 2, 2 );
}
else
{
scale( 0.5, 0.5 );
}

updateRulers();
update();
//redraw cached map items
QList<QGraphicsItem *> itemList = composition()->items();
QList<QGraphicsItem *>::iterator itemIt = itemList.begin();
for ( ; itemIt != itemList.end(); ++itemIt )
{
QgsComposerMap* mypItem = dynamic_cast<QgsComposerMap *>( *itemIt );
if (( mypItem ) && ( mypItem->previewMode() == QgsComposerMap::Render ) )
{
mypItem->updateCachedImage();
}
QPointF itemPoint = theItem->mapFromScene( scenePoint );
theItem->beginCommand( tr( "Zoom item content" ) );
theItem->zoomContent( event->delta(), itemPoint.x(), itemPoint.y() );
theItem->endCommand();
}
}
}
@@ -167,9 +167,6 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
/** Draw a shape on the canvas */
void addShape( Tool currentTool );

bool mPanning;
QPoint mMouseLastXY;

//void connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c );

signals:

0 comments on commit f758597

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