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

Oliver Kellogg okellogg at users.sourceforge.net
Tue Feb 28 19:21:02 UTC 2012


SVN commit 1282732 by okellogg:

On second thought, r1282627 was hacky.
The Right Way of accessing the object name is via UMLObject::name().


 M  +3 -7      objectwidget.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/objectwidget.cpp #1282731:1282732
@@ -130,11 +130,7 @@
     const QFontMetrics &fm = getFontMetrics(FT_UNDERLINE);
     const int fontHeight  = fm.lineSpacing();
     QString objName;
-    if (m_pObject)
-        objName = m_pObject->name();
-    else
-        objName = "1234567";
-    const QString t = m_InstanceName + " : " + objName;
+    const QString t = m_InstanceName + " : " + name();
     const int textWidth = fm.width(t);
     if ( m_drawAsActor ) {
         width = textWidth > A_WIDTH?textWidth:A_WIDTH;
@@ -250,7 +246,7 @@
     const int w = width();
     const int h = height();
 
-    const QString t = m_InstanceName + " : " + m_pObject->name();
+    const QString t = m_InstanceName + " : " + name();
     int multiInstOfst = 0;
     if ( m_multipleInstance ) {
         p.drawRect(offsetX + 10, offsetY + 10, w - 10, h - 10);
@@ -291,7 +287,7 @@
                middleX + A_WIDTH / 2, offsetY + thirdH + thirdH / 2);//arms
     //draw text
     p.setPen(textColor());
-    QString t = m_InstanceName + " : " + m_pObject->name();
+    QString t = m_InstanceName + " : " + name();
     p.drawText(offsetX + A_MARGIN, offsetY + textStartY,
                w - A_MARGIN * 2, fontHeight, Qt::AlignCenter, t);
 }




More information about the umbrello-devel mailing list