Salome HOME
IPAL9192: string resources added for SPlot2d_SetupPlot2dDlg
[modules/gui.git] / src / SalomeApp / SalomeApp_DataObject.cxx
index 0a1bbe819675ac3bd0c54f70f630288417af17bd..e7a922be8f9e89cd8ba5db8db13cd793d38959d6 100644 (file)
@@ -95,6 +95,13 @@ QString SalomeApp_DataObject::name() const
   if ( myObject )
     str = myObject->GetName().c_str();
 
+  if ( str.isEmpty() )
+  {
+    _PTR(SObject) refObj = referencedObject();
+    if ( refObj )
+      str = refObj->GetName().c_str();
+  }
+
   if ( isReference() )
     str = QString( "* " ) + str;
 
@@ -118,18 +125,6 @@ QPixmap SalomeApp_DataObject::icon() const
   return QPixmap();
 }
 
-QColor SalomeApp_DataObject::color() const
-{
-  _PTR(GenericAttribute) anAttr;
-  if ( myObject && myObject->FindAttribute( anAttr, "AttributeTextColor" ) )
-  {
-    _PTR(AttributeTextColor) aColAttr( anAttr );
-    QColor color( (int)aColAttr->TextColor().R, (int)aColAttr->TextColor().G, (int)aColAttr->TextColor().B );
-    return color;
-  }
-  return QColor();
-}
-
 QString SalomeApp_DataObject::text( const int id ) const
 {
   QString txt;
@@ -158,12 +153,15 @@ QColor SalomeApp_DataObject::color( const ColorRole cr ) const
   QColor clr;
   switch ( cr )
   {
-  case Foreground:
+  case Text:
+    if ( isReference() )
+      clr = QColor( 255, 0, 0 );
+    else if ( myObject )
     {
       _PTR(GenericAttribute) anAttr;
-      if ( myObject && myObject->FindAttribute( anAttr, "AttributeTextColor" ) )
+      if ( myObject->FindAttribute( anAttr, "AttributeTextColor" ) )
       {
-       _PTR(AttributeTextColor) aColAttr( anAttr );
+       _PTR(AttributeTextColor) aColAttr = anAttr;
        clr = QColor( (int)aColAttr->TextColor().R, (int)aColAttr->TextColor().G, (int)aColAttr->TextColor().B );
       }
     }