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)
This commit is contained in:
Larry Shaffer 2013-03-06 19:47:32 -07:00
parent 4a36cbdda8
commit 2fe847c9cf
3 changed files with 1 additions and 18 deletions

View File

@ -67,7 +67,6 @@ class QgsComposerView: QGraphicsView
void mouseDoubleClickEvent( QMouseEvent* e );
void keyPressEvent( QKeyEvent * e );
void keyReleaseEvent( QKeyEvent * e );
void wheelEvent( QWheelEvent* event );

View File

@ -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() );

View File

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