[QGIS Commit] r12801 - in trunk/qgis/src: core/composer gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jan 20 05:21:31 EST 2010


Author: mhugent
Date: 2010-01-20 05:21:31 -0500 (Wed, 20 Jan 2010)
New Revision: 12801

Modified:
   trunk/qgis/src/core/composer/qgspaperitem.cpp
   trunk/qgis/src/core/composer/qgspaperitem.h
   trunk/qgis/src/gui/qgscomposerview.cpp
   trunk/qgis/src/gui/qgscomposerview.h
Log:
Make composer a bit more robust against accidential mouse clicks

Modified: trunk/qgis/src/core/composer/qgspaperitem.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgspaperitem.cpp	2010-01-20 10:18:27 UTC (rev 12800)
+++ trunk/qgis/src/core/composer/qgspaperitem.cpp	2010-01-20 10:21:31 UTC (rev 12801)
@@ -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 @@
 {
   return true;
 }
+
+void QgsPaperItem::initialize()
+{
+  setFlag( QGraphicsItem::ItemIsSelectable, false );
+  setFlag( QGraphicsItem::ItemIsMovable, false );
+  setZValue( 0 );
+}

Modified: trunk/qgis/src/core/composer/qgspaperitem.h
===================================================================
--- trunk/qgis/src/core/composer/qgspaperitem.h	2010-01-20 10:18:27 UTC (rev 12800)
+++ trunk/qgis/src/core/composer/qgspaperitem.h	2010-01-20 10:21:31 UTC (rev 12801)
@@ -45,6 +45,8 @@
 
   private:
     QgsPaperItem();
+    /**Set flags and z-value*/
+    void initialize();
 };
 
 #endif

Modified: trunk/qgis/src/gui/qgscomposerview.cpp
===================================================================
--- trunk/qgis/src/gui/qgscomposerview.cpp	2010-01-20 10:18:27 UTC (rev 12800)
+++ trunk/qgis/src/gui/qgscomposerview.cpp	2010-01-20 10:21:31 UTC (rev 12801)
@@ -106,6 +106,7 @@
       mRubberBandLineItem->setZValue( 100 );
       scene()->addItem( mRubberBandLineItem );
       scene()->update();
+      break;
     }
 
     //create rubber band for map and ellipse items
@@ -157,6 +158,7 @@
       addComposerPicture( newPicture );
       newPicture->setSceneRect( QRectF( snappedScenePoint.x(), snappedScenePoint.y(), 30, 30 ) );
       emit actionFinished();
+      break;
     }
     case AddTable:
     {
@@ -164,6 +166,7 @@
       addComposerTable( newTable );
       newTable->setSceneRect( QRectF( snappedScenePoint.x(), snappedScenePoint.y(), 50, 50 ) );
       emit actionFinished();
+      break;
     }
 
     default:
@@ -233,6 +236,7 @@
       addComposerShape( composerShape );
       scene()->removeItem( mRubberBandItem );
       delete mRubberBandItem;
+      mRubberBandItem = 0;
       emit actionFinished();
       break;
     }
@@ -358,6 +362,11 @@
   }
 }
 
+void QgsComposerView::mouseDoubleClickEvent( QMouseEvent* e )
+{
+  e->ignore();
+}
+
 void QgsComposerView::keyPressEvent( QKeyEvent * e )
 {
   if ( e->key() == Qt::Key_Shift )

Modified: trunk/qgis/src/gui/qgscomposerview.h
===================================================================
--- trunk/qgis/src/gui/qgscomposerview.h	2010-01-20 10:18:27 UTC (rev 12800)
+++ trunk/qgis/src/gui/qgscomposerview.h	2010-01-20 10:21:31 UTC (rev 12801)
@@ -102,6 +102,7 @@
     void mousePressEvent( QMouseEvent* );
     void mouseReleaseEvent( QMouseEvent* );
     void mouseMoveEvent( QMouseEvent* );
+    void mouseDoubleClickEvent( QMouseEvent* e );
 
     void keyPressEvent( QKeyEvent * e );
     void keyReleaseEvent( QKeyEvent * e );



More information about the QGIS-commit mailing list