[Uml-devel] KDE/kdesdk/umbrello/umbrello

Ralf Habacker ralf.habacker at gmail.com
Mon Sep 24 20:39:48 UTC 2012


SVN commit 1317628 by habacker:

Resized grid to scene size

 M  +1 -1      umlscene.cpp  
 M  +5 -4      widgets/layoutgrid.cpp  
 M  +2 -1      widgets/layoutgrid.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.cpp #1317627:1317628
@@ -151,7 +151,7 @@
 
 //    // settings for background
 //    setBackgroundBrush(QColor(195, 195, 195));
-    m_layoutGrid = new LayoutGrid();
+    m_layoutGrid = new LayoutGrid(0, this);
     addItem(m_layoutGrid);
 
     DEBUG_REGISTER(DBG_SRC);
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/layoutgrid.cpp #1317627:1317628
@@ -20,6 +20,7 @@
 #include "layoutgrid.h"
 
 #include "debug_utils.h"
+#include "umlscene.h"
 
 #include <QGraphicsScene>
 #include <QGraphicsSceneMouseEvent>
@@ -29,11 +30,11 @@
 /**
  * Constructor.
  */
-LayoutGrid::LayoutGrid(QGraphicsItem *parent, QGraphicsScene *scene)
+LayoutGrid::LayoutGrid(QGraphicsItem *parent, UMLScene *scene)
   : QGraphicsItem(parent, scene),
     m_gridSpacingX(25),
     m_gridSpacingY(25),
-    m_gridRect(QRect(0, 0, 1000, 1000)),
+    m_gridRect(scene->sceneRect().toRect()),
     m_textFont(QFont()),
     m_gridDotColor(Qt::gray),
     m_gridCrossColor(Qt::gray),
@@ -63,8 +64,8 @@
     Q_UNUSED(item); Q_UNUSED(widget);
     DEBUG("LayoutGrid") << "painting...";
     if (m_isVisible) {
-        for(int x = m_gridRect.left(); x < m_gridRect.right(); x = x + m_gridSpacingX) {
-            for(int y = m_gridRect.top(); y < m_gridRect.bottom(); y = y + m_gridSpacingY) {
+        for(int x = m_gridRect.left(); x < m_gridRect.right(); x += m_gridSpacingX) {
+            for(int y = m_gridRect.top(); y < m_gridRect.bottom(); y += m_gridSpacingY) {
                 if (x % 100 == 0 && y % 100 == 0) {
                     // cross
                     painter->setPen(m_gridCrossColor);
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/layoutgrid.h #1317627:1317628
@@ -26,6 +26,7 @@
 
 class QGraphicsScene;
 class QStyleOptionGraphicsItem;
+class UMLScene;
 
 /**
  * @author Andi Fischer
@@ -35,7 +36,7 @@
 class LayoutGrid : public QGraphicsItem
 {
 public:
-    LayoutGrid(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
+    LayoutGrid(QGraphicsItem *parent = 0, UMLScene *scene = 0);
     ~LayoutGrid();
 
     QRectF boundingRect() const;




More information about the umbrello-devel mailing list