Commit 3f8fd461 authored by Ralf Habacker's avatar Ralf Habacker

Fix 'Documentation window does not show the correct icon'.

This commit fixes the issue for selecting entries in the tree view.

CCBUG:381363
parent e38b2965
......@@ -435,7 +435,7 @@ void DocWindow::updateLabel(const QString& name)
icon = Icon_Utils::it_Diagram_Class;
break;
case st_UMLObject:
icon = Icon_Utils::it_Object;
icon = UMLObject::toIcon(m_pUMLObject->baseType());
break;
case st_UMLWidget:
icon = WidgetBase::toIcon(m_pUMLWidget->baseType());
......
......@@ -1193,6 +1193,73 @@ QString UMLObject::toI18nString(ObjectType t)
return name;
}
/**
* Returns the given object type value as icon type.
* @param ot ObjectType of which an icon type is wanted
* @return the ObjectType as icon type
*/
Icon_Utils::IconType UMLObject::toIcon(ObjectType t)
{
Icon_Utils::IconType icon;
switch (t) {
case UMLObject::ot_Actor:
icon = Icon_Utils::it_Actor;
break;
case UMLObject::ot_Artifact:
icon = Icon_Utils::it_Artifact;
break;
case UMLObject::ot_Association:
icon = Icon_Utils::it_Association;
break;
case UMLObject::ot_Class:
icon = Icon_Utils::it_Class;
break;
case UMLObject::ot_Component:
icon = Icon_Utils::it_Component;
break;
case UMLObject::ot_Datatype:
icon = Icon_Utils::it_Datatype;
break;
case UMLObject::ot_Entity:
icon = Icon_Utils::it_Entity;
break;
case UMLObject::ot_Enum:
icon = Icon_Utils::it_Enum;
break;
case UMLObject::ot_Folder:
icon = Icon_Utils::it_Folder;
break;
case UMLObject::ot_Instance:
icon = Icon_Utils::it_Instance;
break;
case UMLObject::ot_Interface:
icon = Icon_Utils::it_Interface;
break;
case UMLObject::ot_Node:
icon = Icon_Utils::it_Node;
break;
case UMLObject::ot_Package:
icon = Icon_Utils::it_Package;
break;
case UMLObject::ot_Port:
icon = Icon_Utils::it_Port;
break;
// case UMLObject::ot_Stereotype:
// icon = Icon_Utils::it_Stereotype;
// break;
case UMLObject::ot_UseCase:
icon = Icon_Utils::it_UseCase;
break;
default:
icon = Icon_Utils::it_Home;
uWarning() << "unknown object type";
break;
}
return icon;
}
/**
* Print UML Object to debug output stream, so it can be used like
* uDebug() << "This object shouldn't be here: " << illegalObject;
......
......@@ -12,6 +12,7 @@
#define UMLOBJECT_H
#include "basictypes.h"
#include "icon_utils.h"
#include "umlpackagelist.h"
//qt includes
......@@ -111,6 +112,7 @@ public:
static QString toString(ObjectType ot);
static QString toI18nString(ObjectType t);
static Icon_Utils::IconType toIcon(ObjectType t);
explicit UMLObject(const UMLObject& other);
explicit UMLObject(UMLObject* parent, const QString& name, Uml::ID::Type id = Uml::ID::None);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment