Skip to content
Permalink
Browse files

Make composer a bit more robust against accidential mouse clicks

git-svn-id: http://svn.osgeo.org/qgis/trunk@12801 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Jan 20, 2010
1 parent 7f6c995 commit 40ee48cd77cd5d931bb397db0c7bf2b61774856a
@@ -20,19 +20,17 @@

QgsPaperItem::QgsPaperItem( QgsComposition* c ): QgsComposerItem( c, false )
{
setFlag( QGraphicsItem::ItemIsSelectable, false );
setZValue( 0 );
initialize();
}

QgsPaperItem::QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition ): QgsComposerItem( x, y, width, height, composition, false )
{
setFlag( QGraphicsItem::ItemIsSelectable, false );
setZValue( 0 );
initialize();
}

QgsPaperItem::QgsPaperItem(): QgsComposerItem( 0, false )
{

initialize();
}

QgsPaperItem::~QgsPaperItem()
@@ -119,3 +117,10 @@ bool QgsPaperItem::readXML( const QDomElement& itemElem, const QDomDocument& doc
{
return true;
}

void QgsPaperItem::initialize()
{
setFlag( QGraphicsItem::ItemIsSelectable, false );
setFlag( QGraphicsItem::ItemIsMovable, false );
setZValue( 0 );
}
@@ -45,6 +45,8 @@ class CORE_EXPORT QgsPaperItem: public QgsComposerItem

private:
QgsPaperItem();
/**Set flags and z-value*/
void initialize();
};

#endif
@@ -106,6 +106,7 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )
mRubberBandLineItem->setZValue( 100 );
scene()->addItem( mRubberBandLineItem );
scene()->update();
break;
}

//create rubber band for map and ellipse items
@@ -157,13 +158,15 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )
addComposerPicture( newPicture );
newPicture->setSceneRect( QRectF( snappedScenePoint.x(), snappedScenePoint.y(), 30, 30 ) );
emit actionFinished();
break;
}
case AddTable:
{
QgsComposerTable* newTable = new QgsComposerTable( composition() );
addComposerTable( newTable );
newTable->setSceneRect( QRectF( snappedScenePoint.x(), snappedScenePoint.y(), 50, 50 ) );
emit actionFinished();
break;
}

default:
@@ -233,6 +236,7 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e )
addComposerShape( composerShape );
scene()->removeItem( mRubberBandItem );
delete mRubberBandItem;
mRubberBandItem = 0;
emit actionFinished();
break;
}
@@ -358,6 +362,11 @@ void QgsComposerView::mouseMoveEvent( QMouseEvent* e )
}
}

void QgsComposerView::mouseDoubleClickEvent( QMouseEvent* e )
{
e->ignore();
}

void QgsComposerView::keyPressEvent( QKeyEvent * e )
{
if ( e->key() == Qt::Key_Shift )
@@ -102,6 +102,7 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
void mousePressEvent( QMouseEvent* );
void mouseReleaseEvent( QMouseEvent* );
void mouseMoveEvent( QMouseEvent* );
void mouseDoubleClickEvent( QMouseEvent* e );

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

0 comments on commit 40ee48c

Please sign in to comment.
You can’t perform that action at this time.