Skip to content

Commit

Permalink
Revert "[FEATURE] Pan composer with middle mouse button"
Browse files Browse the repository at this point in the history
This reverts commit 9bc8c80.
  • Loading branch information
mhugent committed Sep 23, 2013
1 parent 8a94505 commit f758597
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 77 deletions.
7 changes: 0 additions & 7 deletions src/core/composer/qgscomposeritem.cpp
Expand Up @@ -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() ) );
Expand Down
75 changes: 8 additions & 67 deletions src/gui/qgscomposerview.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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();
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/gui/qgscomposerview.h
Expand Up @@ -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:
Expand Down

0 comments on commit f758597

Please sign in to comment.