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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Feb 28 09:35:45 EST 2009


Author: mhugent
Date: 2009-02-28 09:35:45 -0500 (Sat, 28 Feb 2009)
New Revision: 10248

Modified:
   trunk/qgis/python/core/qgscomposerlabel.sip
   trunk/qgis/python/core/qgscomposerlegend.sip
   trunk/qgis/python/core/qgscomposermap.sip
   trunk/qgis/python/core/qgscomposerpicture.sip
   trunk/qgis/python/core/qgscomposerscalebar.sip
   trunk/qgis/python/gui/qgscomposerview.sip
   trunk/qgis/src/core/composer/qgscomposition.cpp
   trunk/qgis/src/gui/qgscomposerview.cpp
Log:
Added /TransferThis/ keywords in the constructor of the composer item classes as suggested by Martin, fixed the possibility of moving the paper item

Modified: trunk/qgis/python/core/qgscomposerlabel.sip
===================================================================
--- trunk/qgis/python/core/qgscomposerlabel.sip	2009-02-27 17:52:17 UTC (rev 10247)
+++ trunk/qgis/python/core/qgscomposerlabel.sip	2009-02-28 14:35:45 UTC (rev 10248)
@@ -7,7 +7,7 @@
 #include "qgscomposerlabel.h"
 %End
   public:
-    QgsComposerLabel( QgsComposition *composition );
+    QgsComposerLabel( QgsComposition *composition /TransferThis/);
     ~QgsComposerLabel();
 
     /** \brief Reimplementation of QCanvasItem::paint*/
@@ -33,4 +33,4 @@
        * @param node is Dom node corresponding to 'ComposerLabel' tag
        */
     bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
-};
\ No newline at end of file
+};

Modified: trunk/qgis/python/core/qgscomposerlegend.sip
===================================================================
--- trunk/qgis/python/core/qgscomposerlegend.sip	2009-02-27 17:52:17 UTC (rev 10247)
+++ trunk/qgis/python/core/qgscomposerlegend.sip	2009-02-28 14:35:45 UTC (rev 10248)
@@ -8,7 +8,7 @@
 %End
 
   public:
-    QgsComposerLegend( QgsComposition* composition );
+    QgsComposerLegend( QgsComposition* composition /TransferThis/);
     ~QgsComposerLegend();
 
     /** \brief Reimplementation of QCanvasItem::paint*/
@@ -94,4 +94,4 @@
 
     /**Helper function that lists ids of layers contained in map canvas*/
     QStringList layerIdList() const;
-};
\ No newline at end of file
+};

Modified: trunk/qgis/python/core/qgscomposermap.sip
===================================================================
--- trunk/qgis/python/core/qgscomposermap.sip	2009-02-27 17:52:17 UTC (rev 10247)
+++ trunk/qgis/python/core/qgscomposermap.sip	2009-02-28 14:35:45 UTC (rev 10248)
@@ -11,9 +11,9 @@
 
   public:
     /** Constructor. */
-    QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height );
+    QgsComposerMap( QgsComposition *composition /TransferThis/, int x, int y, int width, int height );
     /** Constructor. Settings are read from project. */
-    QgsComposerMap( QgsComposition *composition );
+    QgsComposerMap( QgsComposition *composition /TransferThis/ );
     ~QgsComposerMap();
 
     /** \brief Preview style  */
@@ -114,4 +114,4 @@
     /**Returns the zoom factor of the graphics view. If no
      graphics view exists, the default 1 is returned*/
     double horizontalViewScaleFactor() const;
-};
\ No newline at end of file
+};

Modified: trunk/qgis/python/core/qgscomposerpicture.sip
===================================================================
--- trunk/qgis/python/core/qgscomposerpicture.sip	2009-02-27 17:52:17 UTC (rev 10247)
+++ trunk/qgis/python/core/qgscomposerpicture.sip	2009-02-28 14:35:45 UTC (rev 10248)
@@ -9,7 +9,7 @@
 %End
 
   public:
-    QgsComposerPicture( QgsComposition *composition );
+    QgsComposerPicture( QgsComposition *composition /TransferThis/);
     ~QgsComposerPicture();
 
     /**Reimplementation of QCanvasItem::paint*/
@@ -48,4 +48,4 @@
   signals:
     /**Tell the configuration widget that the settings need to be updated*/
     void settingsChanged();
-};
\ No newline at end of file
+};

Modified: trunk/qgis/python/core/qgscomposerscalebar.sip
===================================================================
--- trunk/qgis/python/core/qgscomposerscalebar.sip	2009-02-27 17:52:17 UTC (rev 10247)
+++ trunk/qgis/python/core/qgscomposerscalebar.sip	2009-02-28 14:35:45 UTC (rev 10248)
@@ -9,7 +9,7 @@
 %End
   public:
 
-    QgsComposerScaleBar( QgsComposition* composition );
+    QgsComposerScaleBar( QgsComposition* composition /TransferThis/);
     ~QgsComposerScaleBar();
 
     /** \brief Reimplementation of QCanvasItem::paint*/
@@ -98,4 +98,4 @@
   protected:
     /**Calculates with of a segment in mm and stores it in mSegmentMillimeters*/
     void refreshSegmentMillimeters();
-};
\ No newline at end of file
+};

Modified: trunk/qgis/python/gui/qgscomposerview.sip
===================================================================
--- trunk/qgis/python/gui/qgscomposerview.sip	2009-02-27 17:52:17 UTC (rev 10247)
+++ trunk/qgis/python/gui/qgscomposerview.sip	2009-02-28 14:35:45 UTC (rev 10248)
@@ -42,13 +42,13 @@
     QgsComposition* composition();
     
     /**Adds label to the graphics scene and advices composer to create a widget for it (through signal)*/
-    void addComposerLabel( QgsComposerLabel* label /Transfer/);
+    void addComposerLabel( QgsComposerLabel* label);
     /**Adds map to the graphics scene and advices composer to create a widget for it (through signal)*/
-    void addComposerMap( QgsComposerMap* map /Transfer/);
+    void addComposerMap( QgsComposerMap* map );
     /**Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)*/
-    void addComposerScaleBar( QgsComposerScaleBar* scaleBar /Transfer/);
+    void addComposerScaleBar( QgsComposerScaleBar* scaleBar );
     /**Adds legend to the graphics scene and advices composer to create a widget for it (through signal)*/
-    void addComposerLegend( QgsComposerLegend* legend /Transfer/);
+    void addComposerLegend( QgsComposerLegend* legend );
     /**Adds picture to the graphics scene and advices composer to create a widget for it (through signal)*/
     void addComposerPicture( QgsComposerPicture* picture );
 

Modified: trunk/qgis/src/core/composer/qgscomposition.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposition.cpp	2009-02-27 17:52:17 UTC (rev 10247)
+++ trunk/qgis/src/core/composer/qgscomposition.cpp	2009-02-28 14:35:45 UTC (rev 10248)
@@ -79,7 +79,7 @@
   for ( ; itemIt != itemList.end(); ++itemIt )
   {
     QgsComposerItem* composerItem = dynamic_cast<QgsComposerItem*>( *itemIt );
-    if ( composerItem )
+    if ( composerItem && composerItem != mPaperItem )
     {
       return composerItem;
     }

Modified: trunk/qgis/src/gui/qgscomposerview.cpp
===================================================================
--- trunk/qgis/src/gui/qgscomposerview.cpp	2009-02-27 17:52:17 UTC (rev 10247)
+++ trunk/qgis/src/gui/qgscomposerview.cpp	2009-02-28 14:35:45 UTC (rev 10248)
@@ -57,12 +57,12 @@
 
       //select topmost item at position of event
       QgsComposerItem* selectedItem = composition()->composerItemAt( scenePoint );
-      if ( selectedItem )
+      if ( !selectedItem )
       {
-        selectedItem->setSelected( true );
+        break;
       }
 
-
+      selectedItem->setSelected( true );
       QGraphicsView::mousePressEvent( e );
       emit selectedItemChanged( selectedItem );
       break;
@@ -71,6 +71,7 @@
     case MoveItemContent:
     {
       //store item as member if it is selected and cursor is over item
+      QGraphicsItem* gitem = itemAt( e->pos());
       QgsComposerItem* item = dynamic_cast<QgsComposerItem*>( itemAt( e->pos() ) );
       if ( item )
       {



More information about the QGIS-commit mailing list