[QGIS Commit] r8515 - branches/advanced_printing_branch/src/app/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun May 25 10:06:21 EDT 2008


Author: mhugent
Date: 2008-05-25 10:06:21 -0400 (Sun, 25 May 2008)
New Revision: 8515

Modified:
   branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.h
Log:
Resize for composer picture

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp	2008-05-25 11:38:52 UTC (rev 8514)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp	2008-05-25 14:06:21 UTC (rev 8515)
@@ -694,6 +694,5 @@
   setRect(currentRect.x(), currentRect.y(), currentRect.width() + dx, currentRect.height() + dy);
 
   recalculate();
-  
 }
 

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.cpp	2008-05-25 11:38:52 UTC (rev 8514)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.cpp	2008-05-25 14:06:21 UTC (rev 8515)
@@ -254,10 +254,18 @@
 
 }
 
-void QgsComposerPicture::setSize(double width, double height )
+void QgsComposerPicture::setSize(double width, double height)
 {
-    mWidth = width;
-    mHeight = height;
+  mWidth = width;
+  mHeight = height;
+  adjustPictureSize(); 
+  recalculate();
+}
+
+void QgsComposerPicture::resize(double dx, double dy )
+{
+    mWidth += dx;
+    mHeight += dy;
     adjustPictureSize(); 
 
     recalculate();
@@ -425,6 +433,12 @@
     {
       mWidth = mHeight*box.width()/box.height();
     }
+
+    //make sure the item rect corresponds to mWidth and mHeight...
+    QRectF itemRect = QGraphicsRectItem::rect();
+    itemRect.setWidth(mWidth);
+    itemRect.setHeight(mHeight);
+    QGraphicsRectItem::setRect(itemRect);
 }
 
 void QgsComposerPicture::setOptions ( void )

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.h	2008-05-25 11:38:52 UTC (rev 8514)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.h	2008-05-25 14:06:21 UTC (rev 8515)
@@ -75,9 +75,11 @@
     /** \brief returns TRUE if picture is valid / loaded */
     bool pictureValid();
 
+    void setSize(double width, double height);
+
     // Set box, picture will be inside box, used when placed by mouse.
     // Coordinates do not need to be oriented
-    void setSize(double width, double height );
+    void resize(double dx, double dy);
 
     // Picture dialog, returns file name or empty string
     static QString pictureDialog ( void );    



More information about the QGIS-commit mailing list