[Uml-devel] branches/work/soc-umbrello/umbrello/widgets

Andi Fischer andi.fischer at hispeed.ch
Mon May 10 20:26:47 UTC 2010


SVN commit 1125162 by fischer:

Patch from Eike Krumbacher applied - replacing of package label.

 M  +11 -8     packagewidget.cpp  
 M  +2 -2      packagewidget.h  


--- branches/work/soc-umbrello/umbrello/widgets/packagewidget.cpp #1125161:1125162
@@ -55,10 +55,10 @@
     painter->setBrush(brush());
     painter->setPen(QPen(lineColor(), lineWidth()));
 
-    painter->drawRect(m_topRect);
-    painter->drawRect(m_packageTextRect);
+    painter->drawRect(m_topTextRect);
+    painter->drawRect(m_packageRect);
     if (umlObject()->getStereotype() == "subsystem") {
-        const qreal fHalf = m_topRect.height() / 2;
+        const qreal fHalf = m_topTextRect.height() / 2;
         const qreal symY = fHalf;
         const qreal symX = 38;
         painter->drawLine(symX, symY, symX, symY + fHalf - 2);          // left leg
@@ -77,6 +77,9 @@
     TextItemGroup *grp = textItemGroupAt(GroupIndex);
 
     QSizeF minSize = grp->minimumSize();
+    // add 10.0 to show more than the topTextRect
+    minSize.setWidth(minSize.width() + 10.0);
+
     if(minSize.width() < 70) {
         minSize.setWidth(70);
     }
@@ -115,13 +118,13 @@
 {
     if(change == SizeHasChanged) {
         TextItemGroup *grp = textItemGroupAt(GroupIndex);
+        QSizeF minSize = grp->minimumSize();
+        m_topTextRect.setRect(0, 0, minSize.width(), minSize.height());
 
-        m_topRect.setRect(0, 0, 50, QFontMetricsF(grp->font()).lineSpacing());
+        m_packageRect.setTopLeft(QPointF(0, m_topTextRect.bottom()));
+        m_packageRect.setBottomRight(rect().bottomRight());
 
-        m_packageTextRect.setTopLeft(QPointF(0, m_topRect.bottom()));
-        m_packageTextRect.setBottomRight(rect().bottomRight());
-
-        grp->setGroupGeometry(m_packageTextRect);
+        grp->setGroupGeometry(m_topTextRect);
     }
 
     return UMLWidget::attributeChange(change, oldValue);
--- branches/work/soc-umbrello/umbrello/widgets/packagewidget.h #1125161:1125162
@@ -53,8 +53,8 @@
         TextItemCount
     };
 
-    QRectF m_topRect;
-    QRectF m_packageTextRect;
+    QRectF m_topTextRect;
+    QRectF m_packageRect;
 };
 
 #endif




More information about the umbrello-devel mailing list