Commit e38b2965 authored by Ralf Habacker's avatar Ralf Habacker

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

BUG:381363
FIXED-IN:2.22.3 (KDE Applications 17.04.3)
parent f1fc967d
......@@ -426,28 +426,26 @@ void DocWindow::slotFocusEnabledChanged(int status)
*/
void DocWindow::updateLabel(const QString& name)
{
if (!name.isEmpty()) {
Icon_Utils::IconType icon = Icon_Utils::it_Home;
switch (m_Showing) {
case st_Project:
icon = Icon_Utils::it_Code_Gen_Wizard;
break;
case st_UMLScene:
icon = Icon_Utils::it_Diagram_Class;
break;
case st_UMLObject:
icon = Icon_Utils::it_Object;
break;
case st_UMLWidget:
icon = Icon_Utils::it_Class;
break;
case st_Association:
icon = Icon_Utils::it_Association;
break;
}
m_typeLabel->setPixmap(Icon_Utils::SmallIcon(icon));
m_nameLabel->setText(name);
Icon_Utils::IconType icon = Icon_Utils::it_Home;
switch (m_Showing) {
case st_Project:
icon = Icon_Utils::it_Code_Gen_Wizard;
break;
case st_UMLScene:
icon = Icon_Utils::it_Diagram_Class;
break;
case st_UMLObject:
icon = Icon_Utils::it_Object;
break;
case st_UMLWidget:
icon = WidgetBase::toIcon(m_pUMLWidget->baseType());
break;
case st_Association:
icon = Icon_Utils::it_Association;
break;
}
m_typeLabel->setPixmap(Icon_Utils::SmallIcon(icon));
m_nameLabel->setText(name);
m_modifiedWidget->setModified(isModified());
}
......
......@@ -1156,6 +1156,114 @@ QString WidgetBase::toI18nString(WidgetType wt)
return name;
}
/**
* Returns the given enum value as icon type.
* @param wt WidgetType of which an icon type representation is wanted
* @return the WidgetType as icon type
*/
Icon_Utils::IconType WidgetBase::toIcon(WidgetBase::WidgetType wt)
{
Icon_Utils::IconType icon;
switch (wt) {
case wt_Activity:
icon = Icon_Utils::it_Activity;
break;
case wt_Actor:
icon = Icon_Utils::it_Actor;
break;
case wt_Artifact:
icon = Icon_Utils::it_Artifact;
break;
case wt_Association:
icon = Icon_Utils::it_Association;
break;
case wt_Box:
icon = Icon_Utils::it_Box;
break;
case wt_Category:
icon = Icon_Utils::it_Category;
break;
case wt_CombinedFragment:
icon = Icon_Utils::it_Combined_Fragment;
break;
case wt_Component:
icon = Icon_Utils::it_Component;
break;
case wt_Class:
icon = Icon_Utils::it_Class;
break;
case wt_Datatype:
icon = Icon_Utils::it_Datatype;
break;
case wt_Entity:
icon = Icon_Utils::it_Entity;
break;
case wt_Enum:
icon = Icon_Utils::it_Enum;
break;
case wt_FloatingDashLine:
icon = Icon_Utils::it_Association;
break;
case wt_ForkJoin:
icon = Icon_Utils::it_Fork_Join;
break;
case wt_Instance:
icon = Icon_Utils::it_Instance;
break;
case wt_Interface:
icon = Icon_Utils::it_Interface;
break;
case wt_Message:
icon = Icon_Utils::it_Message_Synchronous;
break;
case wt_Node:
icon = Icon_Utils::it_Node;
break;
case wt_Note:
icon = Icon_Utils::it_Note;
break;
case wt_Object:
icon = Icon_Utils::it_Object;
break;
case wt_ObjectNode:
icon = Icon_Utils::it_Object_Node;
break;
case wt_Package:
icon = Icon_Utils::it_Package;
break;
case wt_Pin:
icon = Icon_Utils::it_Pin;
break;
case wt_Port:
icon = Icon_Utils::it_Port;
break;
case wt_Precondition:
icon = Icon_Utils::it_Precondition;
break;
case wt_Region:
icon = Icon_Utils::it_Region;
break;
case wt_Signal:
icon = Icon_Utils::it_Send_Signal;
break;
case wt_State:
icon = Icon_Utils::it_State;
break;
case wt_Text:
icon = Icon_Utils::it_Text;
break;
case wt_UseCase:
icon = Icon_Utils::it_UseCase;
break;
default:
icon = Icon_Utils::it_Home;
uWarning() << "unknown widget type";
break;
}
return icon;
}
#include "activitywidget.h"
#include "actorwidget.h"
#include "artifactwidget.h"
......
......@@ -12,6 +12,7 @@
#define WIDGETBASE_H
#include "basictypes.h"
#include "icon_utils.h"
#include <QColor>
#include <QDomDocument>
......@@ -109,6 +110,7 @@ public:
static QString toString(WidgetType wt);
static QString toI18nString(WidgetType wt);
static Icon_Utils::IconType toIcon(WidgetType wt);
explicit WidgetBase(UMLScene * scene, WidgetType type= wt_UMLWidget);
virtual ~WidgetBase();
......
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