Skip to content
Permalink
Browse files
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 2fe847c9cf0d36316085195be82e32992f296c6d
Showing with 1 addition and 18 deletions.
  1. +0 −1 python/gui/qgscomposerview.sip
  2. +1 −14 src/gui/qgscomposerview.cpp
  3. +0 −3 src/gui/qgscomposerview.h
@@ -67,7 +67,6 @@ class QgsComposerView: QGraphicsView
void mouseDoubleClickEvent( QMouseEvent* e );

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

void wheelEvent( QWheelEvent* event );

@@ -39,7 +39,6 @@

QgsComposerView::QgsComposerView( QWidget* parent, const char* name, Qt::WFlags f )
: QGraphicsView( parent )
, mShiftKeyPressed( false )
, mRubberBandItem( 0 )
, mRubberBandLineItem( 0 )
, mMoveContentItem( 0 )
@@ -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();
}
@@ -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() )
{
@@ -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() );
@@ -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 );

@@ -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*/

0 comments on commit 2fe847c

Please sign in to comment.