Skip to content

Commit

Permalink
[FEATURE] holding shift while pressing cursor keys results in large m…
Browse files Browse the repository at this point in the history
…ovements in composer
  • Loading branch information
nyalldawson authored and mhugent committed Sep 5, 2013
1 parent 151e0cc commit f365257
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/gui/qgscomposerview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,14 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
QList<QgsComposerItem*> composerItemList = composition()->selectedComposerItems();
QList<QgsComposerItem*>::iterator itemIt = composerItemList.begin();

// increment used for cursor key item movement
double increment = 1.0;
if ( e->modifiers() & Qt::ShiftModifier )
{
//holding shift while pressing cursor keys results in a big step
increment = 10.0;
}

if ( e->matches( QKeySequence::Copy ) || e->matches( QKeySequence::Cut ) )
{
QDomDocument doc;
Expand Down Expand Up @@ -582,7 +590,7 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
for ( ; itemIt != composerItemList.end(); ++itemIt )
{
( *itemIt )->beginCommand( tr( "Item moved" ), QgsComposerMergeCommand::ItemMove );
( *itemIt )->move( -1.0, 0.0 );
( *itemIt )->move( -1 * increment, 0.0 );
( *itemIt )->endCommand();
}
}
Expand All @@ -591,7 +599,7 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
for ( ; itemIt != composerItemList.end(); ++itemIt )
{
( *itemIt )->beginCommand( tr( "Item moved" ), QgsComposerMergeCommand::ItemMove );
( *itemIt )->move( 1.0, 0.0 );
( *itemIt )->move( increment, 0.0 );
( *itemIt )->endCommand();
}
}
Expand All @@ -600,7 +608,7 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
for ( ; itemIt != composerItemList.end(); ++itemIt )
{
( *itemIt )->beginCommand( tr( "Item moved" ), QgsComposerMergeCommand::ItemMove );
( *itemIt )->move( 0.0, 1.0 );
( *itemIt )->move( 0.0, increment );
( *itemIt )->endCommand();
}
}
Expand All @@ -609,7 +617,7 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
for ( ; itemIt != composerItemList.end(); ++itemIt )
{
( *itemIt )->beginCommand( tr( "Item moved" ), QgsComposerMergeCommand::ItemMove );
( *itemIt )->move( 0.0, -1.0 );
( *itemIt )->move( 0.0, -1 * increment );
( *itemIt )->endCommand();
}
}
Expand Down

0 comments on commit f365257

Please sign in to comment.