Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Keep composer multi-item selection only when Shift is pressed during …
…click

- Fixes issues where Shift was still registered as pressed when shift click happened outside of view (due to lingering keyboard focus)
  • Loading branch information
dakcarto committed Mar 7, 2013
1 parent 4a36cbd commit 2fe847c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
1 change: 0 additions & 1 deletion python/gui/qgscomposerview.sip
Expand Up @@ -67,7 +67,6 @@ class QgsComposerView: QGraphicsView
void mouseDoubleClickEvent( QMouseEvent* e );

void keyPressEvent( QKeyEvent * e );
void keyReleaseEvent( QKeyEvent * e );

void wheelEvent( QWheelEvent* event );

Expand Down
15 changes: 1 addition & 14 deletions src/gui/qgscomposerview.cpp
Expand Up @@ -39,7 +39,6 @@

QgsComposerView::QgsComposerView( QWidget* parent, const char* name, Qt::WFlags f )
: QGraphicsView( parent )
, mShiftKeyPressed( false )
, mRubberBandItem( 0 )
, mRubberBandLineItem( 0 )
, mMoveContentItem( 0 )
Expand Down Expand Up @@ -84,7 +83,7 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )
//select/deselect items and pass mouse event further
case Select:
{
if ( !mShiftKeyPressed ) //keep selection if shift key pressed
if ( !( e->modifiers() & Qt::ShiftModifier ) ) //keep selection if shift key pressed
{
composition()->clearSelection();
}
Expand Down Expand Up @@ -449,10 +448,6 @@ void QgsComposerView::mouseDoubleClickEvent( QMouseEvent* e )
void QgsComposerView::keyPressEvent( QKeyEvent * e )
{
//TODO : those should be actions (so we could also display menu items and/or toolbar items)
if ( e->key() == Qt::Key_Shift )
{
mShiftKeyPressed = true;
}

if ( !composition() )
{
Expand Down Expand Up @@ -562,14 +557,6 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
}
}

void QgsComposerView::keyReleaseEvent( QKeyEvent * e )
{
if ( e->key() == Qt::Key_Shift )
{
mShiftKeyPressed = false;
}
}

void QgsComposerView::wheelEvent( QWheelEvent* event )
{
QPointF scenePoint = mapToScene( event->pos() );
Expand Down
3 changes: 0 additions & 3 deletions src/gui/qgscomposerview.h
Expand Up @@ -96,7 +96,6 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
void mouseDoubleClickEvent( QMouseEvent* e );

void keyPressEvent( QKeyEvent * e );
void keyReleaseEvent( QKeyEvent * e );

void wheelEvent( QWheelEvent* event );

Expand All @@ -106,8 +105,6 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
void showEvent( QShowEvent* e );

private:
/**Status of shift key (used for multiple selection)*/
bool mShiftKeyPressed;
/**Current composer tool*/
QgsComposerView::Tool mCurrentTool;
/**Rubber band item*/
Expand Down

0 comments on commit 2fe847c

Please sign in to comment.