umbrello 25.04.1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
umllistviewitem.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2022 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef UMLLISTVIEWITEM_H
7#define UMLLISTVIEWITEM_H
8
9#include "basictypes.h"
10#include "icon_utils.h"
11
12#include <QDomDocument>
13#include <QDomElement>
14#include <QHash>
15#include <QPointer>
16#include <QTreeWidget>
17#include <QXmlStreamWriter>
18
19// forward declarations
20class UMLListView;
21class UMLObject;
23
24typedef QTreeWidgetItemIterator UMLListViewItemIterator;
25
35class UMLListViewItem : public QTreeWidgetItem
36{
37public:
39 {
40 //the values in this enum are saved out to the file
41 //for file compatibility, only add new values to the end
42 lvt_Min = 799,
43 lvt_View = 800,
66 lvt_Diagrams, // currently unused
102 // enter new values above
104 lvt_Unknown = -1
105 };
106
107 static QString toString(ListViewType type);
108
109 UMLListViewItem(UMLListView *parent, const QString &name, ListViewType t, UMLObject *o = nullptr);
110 explicit UMLListViewItem(UMLListView * parent);
111 explicit UMLListViewItem(UMLListViewItem * parent);
112 UMLListViewItem(UMLListViewItem *parent, const QString &name, ListViewType t, UMLObject *o = nullptr);
113 UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, Uml::ID::Type id);
114
115 ListViewType type() const;
116
117 void setID(Uml::ID::Type id);
118 Uml::ID::Type ID() const;
119
120 void setUMLObject(UMLObject * obj);
121 UMLObject * umlObject() const;
122
123 bool isOwnParent(Uml::ID::Type listViewItemID);
124
125 void updateObject();
126 void updateFolder();
127
128 void setText(int column, const QString &text);
129 void setText(const QString &text);
130 QString getSavedText() const;
131 void setVisible(bool state);
132
133 QString toolTip() const;
134
135 void setIcon(Icon_Utils::IconType iconType);
136
138
139 void deleteChildItem(UMLObject *child);
141
142 //virtual int compare(UMLListViewItem *other, int col, bool ascending) const;
143
145
149
151
152 void saveToXMI(QXmlStreamWriter& writer);
153 bool loadFromXMI(QDomElement& qElement);
154
155 bool isOpen() const { return isExpanded(); }
156 void setOpen(bool state);
157
158public Q_SLOTS:
159 void slotEditFinished(const QString &newText);
160
161protected:
162 void init();
163
164 void cancelRenameWithMsg();
165
167
174 typedef QHash<const UMLObject*, UMLListViewItem*> ChildObjectMap;
175
178 QPointer<UMLObject> m_object;
179 QString m_label;
181
182};
183
184QDebug operator<<(QDebug dbg, const UMLListViewItem& item);
185
186#endif
A base class for classifier list items (e.g. attributes)
Definition classifierlistitem.h:25
Items used by UMLListView.
Definition umllistviewitem.h:36
void updateFolder()
Definition umllistviewitem.cpp:440
UMLListViewItem * deepCopy(UMLListViewItem *newParent)
Definition umllistviewitem.cpp:839
ListViewType m_type
Definition umllistviewitem.h:176
void setUMLObject(UMLObject *obj)
Definition umllistviewitem.cpp:319
QString m_label
Definition umllistviewitem.h:179
UMLListViewItem * findUMLObject(const UMLObject *o)
Definition umllistviewitem.cpp:863
static ChildObjectMap * s_comap
Definition umllistviewitem.h:180
UMLObject * umlObject() const
Definition umllistviewitem.cpp:329
QString getSavedText() const
Definition umllistviewitem.cpp:482
void slotEditFinished(const QString &newText)
Definition umllistviewitem.cpp:501
void cancelRenameWithMsg()
Definition umllistviewitem.cpp:730
static QString toString(ListViewType type)
Definition umllistviewitem.cpp:1013
void setText(int column, const QString &text)
Definition umllistviewitem.cpp:473
Uml::ID::Type ID() const
Definition umllistviewitem.cpp:288
Uml::ID::Type m_id
Definition umllistviewitem.h:177
QString toolTip() const
Definition umllistviewitem.cpp:196
ListViewType
Definition umllistviewitem.h:39
@ lvt_Logical_Folder
Definition umllistviewitem.h:46
@ lvt_UseCase_Folder
Definition umllistviewitem.h:47
@ lvt_Association
Definition umllistviewitem.h:98
@ lvt_View
Definition umllistviewitem.h:43
@ lvt_Deployment_View
Definition umllistviewitem.h:70
@ lvt_Actor
Definition umllistviewitem.h:54
@ lvt_State_Diagram
Definition umllistviewitem.h:51
@ lvt_Node
Definition umllistviewitem.h:71
@ lvt_Component_View
Definition umllistviewitem.h:64
@ lvt_Properties_UserInterface
Definition umllistviewitem.h:97
@ lvt_Collaboration_Diagram
Definition umllistviewitem.h:49
@ lvt_Properties_Font
Definition umllistviewitem.h:95
@ lvt_Deployment_Folder
Definition umllistviewitem.h:69
@ lvt_Max
Definition umllistviewitem.h:103
@ lvt_Operation
Definition umllistviewitem.h:58
@ lvt_Entity
Definition umllistviewitem.h:75
@ lvt_Class
Definition umllistviewitem.h:56
@ lvt_EntityRelationship_Diagram
Definition umllistviewitem.h:77
@ lvt_PrimaryKeyConstraint
Definition umllistviewitem.h:84
@ lvt_Component
Definition umllistviewitem.h:65
@ lvt_Properties_CodeImport
Definition umllistviewitem.h:93
@ lvt_Deployment_Diagram
Definition umllistviewitem.h:68
@ lvt_Diagrams
Definition umllistviewitem.h:66
@ lvt_Enum
Definition umllistviewitem.h:74
@ lvt_ForeignKeyConstraint
Definition umllistviewitem.h:85
@ lvt_UseCase_View
Definition umllistviewitem.h:45
@ lvt_Properties
Definition umllistviewitem.h:89
@ lvt_Logical_View
Definition umllistviewitem.h:44
@ lvt_Component_Folder
Definition umllistviewitem.h:63
@ lvt_Datatype_Folder
Definition umllistviewitem.h:73
@ lvt_Properties_AutoLayout
Definition umllistviewitem.h:90
@ lvt_Properties_CodeGeneration
Definition umllistviewitem.h:92
@ lvt_UseCase
Definition umllistviewitem.h:55
@ lvt_Datatype
Definition umllistviewitem.h:72
@ lvt_Object_Diagram
Definition umllistviewitem.h:99
@ lvt_UniqueConstraint
Definition umllistviewitem.h:83
@ lvt_EntityRelationship_Model
Definition umllistviewitem.h:79
@ lvt_EnumLiteral
Definition umllistviewitem.h:82
@ lvt_Instance
Definition umllistviewitem.h:100
@ lvt_Interface
Definition umllistviewitem.h:60
@ lvt_Activity_Diagram
Definition umllistviewitem.h:52
@ lvt_EntityRelationship_Folder
Definition umllistviewitem.h:78
@ lvt_InstanceAttribute
Definition umllistviewitem.h:101
@ lvt_Properties_Class
Definition umllistviewitem.h:91
@ lvt_Min
Definition umllistviewitem.h:42
@ lvt_Attribute
Definition umllistviewitem.h:57
@ lvt_Category
Definition umllistviewitem.h:87
@ lvt_EntityAttribute
Definition umllistviewitem.h:76
@ lvt_Unknown
Definition umllistviewitem.h:104
@ lvt_Model
Definition umllistviewitem.h:81
@ lvt_Template
Definition umllistviewitem.h:59
@ lvt_Port
Definition umllistviewitem.h:88
@ lvt_Component_Diagram
Definition umllistviewitem.h:62
@ lvt_UseCase_Diagram
Definition umllistviewitem.h:48
@ lvt_Properties_General
Definition umllistviewitem.h:96
@ lvt_Subsystem
Definition umllistviewitem.h:80
@ lvt_Artifact
Definition umllistviewitem.h:67
@ lvt_CheckConstraint
Definition umllistviewitem.h:86
@ lvt_Sequence_Diagram
Definition umllistviewitem.h:53
@ lvt_Class_Diagram
Definition umllistviewitem.h:50
@ lvt_Package
Definition umllistviewitem.h:61
@ lvt_Properties_CodeViewer
Definition umllistviewitem.h:94
QPointer< UMLObject > m_object
Definition umllistviewitem.h:178
ListViewType type() const
Definition umllistviewitem.cpp:227
void setID(Uml::ID::Type id)
Definition umllistviewitem.cpp:302
void saveToXMI(QXmlStreamWriter &writer)
Definition umllistviewitem.cpp:941
void init()
Definition umllistviewitem.cpp:183
UMLListViewItem * findChildObject(const UMLObject *child)
Definition umllistviewitem.cpp:906
void updateObject()
Definition umllistviewitem.cpp:357
void setVisible(bool state)
Definition umllistviewitem.cpp:278
static void deleteItem(UMLListViewItem *childItem)
Definition umllistviewitem.cpp:268
void setIcon(Icon_Utils::IconType iconType)
Definition umllistviewitem.cpp:490
void addChildItem(UMLObject *child, UMLListViewItem *childItem)
Definition umllistviewitem.cpp:237
UMLListViewItem * findUMLObject_r(const UMLObject *o)
Definition umllistviewitem.cpp:883
QHash< const UMLObject *, UMLListViewItem * > ChildObjectMap
Definition umllistviewitem.h:174
void setOpen(bool state)
Definition umllistviewitem.cpp:456
bool loadFromXMI(QDomElement &qElement)
Definition umllistviewitem.cpp:983
UMLListViewItem * findItem(Uml::ID::Type id)
Definition umllistviewitem.cpp:923
bool isOpen() const
Definition umllistviewitem.h:155
UMLListViewItem * childItem(int i)
Definition umllistviewitem.cpp:1008
bool isOwnParent(Uml::ID::Type listViewItemID)
Definition umllistviewitem.cpp:338
void deleteChildItem(UMLObject *child)
Definition umllistviewitem.cpp:249
Displays the list view for the program.
Definition umllistview.h:43
The base class for UML objects.
Definition umlobject.h:70
IconType
Definition icon_utils.h:25
std::string Type
Definition basictypes.h:371
QDebug operator<<(QDebug dbg, const UMLListViewItem &item)
Definition umllistviewitem.cpp:1128
QTreeWidgetItemIterator UMLListViewItemIterator
Definition umllistviewitem.h:24