umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

umllistview.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef UMLLISTVIEW_H
7#define UMLLISTVIEW_H
8
9#include "basictypes.h"
10#include "umllistviewitem.h"
11#include "umllistviewitemlist.h"
12#include "icon_utils.h"
13#include "umlobject.h"
14
15#include <QDomDocument>
16#include <QDomElement>
17#include <QTreeWidget>
18#include <QTreeWidgetItem>
19#include <QXmlStreamWriter>
20
21 class QEvent;
22 class QMouseEvent;
23 class QFocusEvent;
24 class QKeyEvent;
25 class QDropEvent;
26 class UMLClassifier;
27 class UMLDoc;
28 class UMLView;
29 class UMLClassifierListItem;
30 class UMLDragData;
31
42 class UMLListView : public QTreeWidget
43{
44 Q_OBJECT
45 public:
46 explicit UMLListView(QWidget *parent = 0);
47 ~UMLListView();
48
49 void setDocument(UMLDoc * doc);
50 UMLDoc * document() const;
51
52 void init();
53 void clean();
54
55 void setView(UMLView* view);
56
57 void setTitle(int column, const QString &text);
58
59 UMLListViewItemList selectedItems() const;
60 UMLListViewItemList selectedItemsRoot() const;
61 int selectedItemsCount() const;
62
63 UMLListViewItem* createDiagramItem(UMLView *view);
64
65 bool createItem(UMLListViewItem *item);
66
67 UMLListViewItem* findFolderForDiagram(Uml::DiagramType::Enum dt) const;
68
69 UMLListViewItem* determineParentItem(UMLObject* object) const;
70 UMLListViewItem* determineParentItem(UMLListViewItem::ListViewType lvt) const;
71
72 static bool mayHaveChildItems(UMLObject::ObjectType type);
73
74 void addNewItem(UMLListViewItem * parent, UMLListViewItem::ListViewType type);
75
76 UMLListViewItem * findUMLObject(const UMLObject *p) const;
77 UMLListViewItem * findView(UMLView *v);
78 UMLListViewItem * findItem(Uml::ID::Type id);
79
80 UMLListViewItem *rootView(UMLListViewItem::ListViewType type);
81
82 void changeIconOf(UMLObject *o, Icon_Utils::IconType to);
83
84 bool isUnique(UMLListViewItem * item, const QString &name) const;
85
86 void setStartedCut(bool startedCut);
87 void setStartedCopy(bool startedCopy);
88 bool startedCopy() const;
89
90 UMLListViewItem * moveObject(Uml::ID::Type srcId, UMLListViewItem::ListViewType srcType,
91 UMLListViewItem *newParent);
92
93 void closeDatatypesFolder();
94
95 UMLListViewItem *theRootView() { return m_rv; }
96 UMLListViewItem *theLogicalView() { return m_lv[Uml::ModelType::Logical]; }
97 UMLListViewItem *theUseCaseView() { return m_lv[Uml::ModelType::UseCase]; }
98 UMLListViewItem *theComponentView() { return m_lv[Uml::ModelType::Component]; }
99 UMLListViewItem *theDeploymentView() { return m_lv[Uml::ModelType::Deployment]; }
100 UMLListViewItem *theDatatypeFolder() { return m_datatypeFolder; }
101
102 UMLListViewItem::ListViewType rootViewType(UMLListViewItem *item);
103
104 void saveToXMI(QXmlStreamWriter& writer);
105 bool loadFromXMI(QDomElement & element);
106 bool loadChildrenFromXMI(UMLListViewItem * parent, QDomElement & element);
107
108 friend QDebug operator<<(QDebug out, const UMLListView& view);
109
110 protected:
111 bool event(QEvent *e);
112 void mouseReleaseEvent(QMouseEvent *me);
113 void mousePressEvent(QMouseEvent *me);
114 void mouseMoveEvent(QMouseEvent *me);
115 void mouseDoubleClickEvent(QMouseEvent *me);
116 void focusOutEvent (QFocusEvent *fe);
117 void contextMenuEvent(QContextMenuEvent *event);
118 UMLDragData* getDragData();
119
120 bool acceptDrag(QDropEvent* event) const;
121 void keyPressEvent(QKeyEvent* ke);
122 void dragEnterEvent(QDragEnterEvent* event);
123 void dragMoveEvent(QDragMoveEvent* event);
124 void dropEvent(QDropEvent* event);
125 void commitData(QWidget *editor);
126
127 UMLListViewItem * findUMLObjectInFolder(UMLListViewItem *folder, UMLObject *obj);
128
129 static bool isExpandable(UMLListViewItem::ListViewType lvt);
130
131 void deleteChildrenOf(UMLListViewItem *parent);
132
133 bool deleteItem(UMLListViewItem *temp);
134
135 void childObjectAdded(UMLClassifierListItem* child, UMLClassifier* parent);
136
137 void addAtContainer(UMLListViewItem *item, UMLListViewItem *parent);
138
139 public slots:
140 void slotDiagramCreated(Uml::ID::Type id);
141 void slotDiagramRenamed(Uml::ID::Type id);
142 void slotDiagramRemoved(Uml::ID::Type id);
143 void slotObjectCreated(UMLObject* object);
144 void slotObjectRemoved(UMLObject* object);
145
146 void connectNewObjectsSlots(UMLObject* object);
147
148 void childObjectAdded(UMLClassifierListItem* obj);
149 void childObjectRemoved(UMLClassifierListItem* obj);
150
151 void slotObjectChanged();
152
153 void slotMenuSelection(QAction* action, const QPoint &position = QPoint());
154
155 void slotDropped(QDropEvent* de, UMLListViewItem* target);
156
157 void expandAll(UMLListViewItem *item);
158 void collapseAll(UMLListViewItem *item);
159
160 void slotCutSuccessful();
161 void slotDeleteSelectedItems();
162
163 protected slots:
164 void slotItemSelectionChanged();
165 void slotExpanded(QTreeWidgetItem* item);
166 void slotCollapsed(QTreeWidgetItem* item);
167
168 private:
169 UMLListViewItem* recursiveSearchForView(UMLListViewItem* folder,
170 UMLListViewItem::ListViewType type, Uml::ID::Type id);
171
172 void setBackgroundColor(const QColor & color);
173
174 UMLListViewItem* m_rv;
175 UMLListViewItem* m_lv[Uml::ModelType::N_MODELTYPES];
176 UMLListViewItem* m_datatypeFolder;
177 UMLListViewItem* m_settingsFolder;
178 UMLDoc* m_doc;
179 bool m_bStartedCut;
180 bool m_bStartedCopy;
181 bool m_bCreatingChildObject;
182 QPoint m_dragStartPosition;
183 QMimeData* m_dragCopyData;
184 QList<QTreeWidgetItem*> m_findItems;
185};
186
187#endif
basictypes.h
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition classifierlistitem.h:25
UMLClassifier
Information for a non-graphical Concept/Class.
Definition classifier.h:35
UMLDoc
Definition umldoc.h:63
UMLDragData
Definition umldragdata.h:33
UMLListViewItem
Items used by UMLListView.
Definition umllistviewitem.h:36
UMLListViewItem::ListViewType
ListViewType
Definition umllistviewitem.h:39
UMLListView
Displays the list view for the program.
Definition umllistview.h:43
UMLListView::setDocument
void setDocument(UMLDoc *doc)
Definition umllistview.cpp:1197
UMLListView::slotDropped
void slotDropped(QDropEvent *de, UMLListViewItem *target)
Definition umllistview.cpp:1936
UMLListView::slotExpanded
void slotExpanded(QTreeWidgetItem *item)
Definition umllistview.cpp:2183
UMLListView::setBackgroundColor
void setBackgroundColor(const QColor &color)
Definition umllistview.cpp:2936
UMLListView::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event)
Definition umllistview.cpp:2865
UMLListView::findView
UMLListViewItem * findView(UMLView *v)
Definition umllistview.cpp:1334
UMLListView::document
UMLDoc * document() const
Definition umllistview.cpp:2097
UMLListView::slotCutSuccessful
void slotCutSuccessful()
Definition umllistview.cpp:2210
UMLListView::init
void init()
Definition umllistview.cpp:1415
UMLListView::moveObject
UMLListViewItem * moveObject(Uml::ID::Type srcId, UMLListViewItem::ListViewType srcType, UMLListViewItem *newParent)
Definition umllistview.cpp:1630
UMLListView::slotItemSelectionChanged
void slotItemSelectionChanged()
Definition umllistview.cpp:155
UMLListView::theDeploymentView
UMLListViewItem * theDeploymentView()
Definition umllistview.h:99
UMLListView::theUseCaseView
UMLListViewItem * theUseCaseView()
Definition umllistview.h:97
UMLListView::m_settingsFolder
UMLListViewItem * m_settingsFolder
settings root
Definition umllistview.h:177
UMLListView::slotObjectRemoved
void slotObjectRemoved(UMLObject *object)
Definition umllistview.cpp:1215
UMLListView::slotDiagramRemoved
void slotDiagramRemoved(Uml::ID::Type id)
Definition umllistview.cpp:1230
UMLListView::addNewItem
void addNewItem(UMLListViewItem *parent, UMLListViewItem::ListViewType type)
Definition umllistview.cpp:2236
UMLListView::dropEvent
void dropEvent(QDropEvent *event)
Definition umllistview.cpp:2887
UMLListView::slotDiagramRenamed
void slotDiagramRenamed(Uml::ID::Type id)
Definition umllistview.cpp:1180
UMLListView::mayHaveChildItems
static bool mayHaveChildItems(UMLObject::ObjectType type)
Definition umllistview.cpp:920
UMLListView::loadChildrenFromXMI
bool loadChildrenFromXMI(UMLListViewItem *parent, QDomElement &element)
Definition umllistview.cpp:2475
UMLListView::m_bStartedCopy
bool m_bStartedCopy
Definition umllistview.h:180
UMLListView::mousePressEvent
void mousePressEvent(QMouseEvent *me)
Definition umllistview.cpp:197
UMLListView::deleteItem
bool deleteItem(UMLListViewItem *temp)
Definition umllistview.cpp:2802
UMLListView::event
bool event(QEvent *e)
Definition umllistview.cpp:177
UMLListView::isExpandable
static bool isExpandable(UMLListViewItem::ListViewType lvt)
Definition umllistview.cpp:2164
UMLListView::keyPressEvent
void keyPressEvent(QKeyEvent *ke)
Definition umllistview.cpp:302
UMLListView::findFolderForDiagram
UMLListViewItem * findFolderForDiagram(Uml::DiagramType::Enum dt) const
Definition umllistview.cpp:796
UMLListView::createDiagramItem
UMLListViewItem * createDiagramItem(UMLView *view)
Definition umllistview.cpp:2017
UMLListView::acceptDrag
bool acceptDrag(QDropEvent *event) const
Definition umllistview.cpp:1527
UMLListView::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *event)
Definition umllistview.cpp:2118
UMLListView::focusOutEvent
void focusOutEvent(QFocusEvent *fe)
Definition umllistview.cpp:2106
UMLListView::theLogicalView
UMLListViewItem * theLogicalView()
Definition umllistview.h:96
UMLListView::loadFromXMI
bool loadFromXMI(QDomElement &element)
Definition umllistview.cpp:2448
UMLListView::selectedItemsCount
int selectedItemsCount() const
Definition umllistview.cpp:2088
UMLListView::slotDeleteSelectedItems
void slotDeleteSelectedItems()
Definition umllistview.cpp:2223
UMLListView::slotCollapsed
void slotCollapsed(QTreeWidgetItem *item)
Definition umllistview.cpp:2196
UMLListView::startedCopy
bool startedCopy() const
Definition umllistview.cpp:2733
UMLListView::recursiveSearchForView
UMLListViewItem * recursiveSearchForView(UMLListViewItem *folder, UMLListViewItem::ListViewType type, Uml::ID::Type id)
Definition umllistview.cpp:1374
UMLListView::deleteChildrenOf
void deleteChildrenOf(UMLListViewItem *parent)
Definition umllistview.cpp:2777
UMLListView::findItem
UMLListViewItem * findItem(Uml::ID::Type id)
Definition umllistview.cpp:1400
UMLListView::m_datatypeFolder
UMLListViewItem * m_datatypeFolder
Definition umllistview.h:176
UMLListView::isUnique
bool isUnique(UMLListViewItem *item, const QString &name) const
Definition umllistview.cpp:2330
UMLListView::setView
void setView(UMLView *view)
Definition umllistview.cpp:1479
UMLListView::m_bCreatingChildObject
bool m_bCreatingChildObject
when creating an attribute or an operation to stop it adding a second listViewItem
Definition umllistview.h:181
UMLListView::~UMLListView
~UMLListView()
Definition umllistview.cpp:134
UMLListView::childObjectAdded
void childObjectAdded(UMLClassifierListItem *child, UMLClassifier *parent)
Definition umllistview.cpp:1131
UMLListView::connectNewObjectsSlots
void connectNewObjectsSlots(UMLObject *object)
Definition umllistview.cpp:1015
UMLListView::findUMLObjectInFolder
UMLListViewItem * findUMLObjectInFolder(UMLListViewItem *folder, UMLObject *obj)
Definition umllistview.cpp:1265
UMLListView::selectedItemsRoot
UMLListViewItemList selectedItemsRoot() const
Definition umllistview.cpp:1991
UMLListView::commitData
void commitData(QWidget *editor)
Definition umllistview.cpp:2903
UMLListView::theRootView
UMLListViewItem * theRootView()
Definition umllistview.h:95
UMLListView::expandAll
void expandAll(UMLListViewItem *item)
Definition umllistview.cpp:2689
UMLListView::childObjectRemoved
void childObjectRemoved(UMLClassifierListItem *obj)
Definition umllistview.cpp:1165
UMLListView::clean
void clean()
Definition umllistview.cpp:1465
UMLListView::rootViewType
UMLListViewItem::ListViewType rootViewType(UMLListViewItem *item)
Definition umllistview.cpp:2141
UMLListView::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *me)
Definition umllistview.cpp:1491
UMLListView::createItem
bool createItem(UMLListViewItem *item)
UMLListView::theComponentView
UMLListViewItem * theComponentView()
Definition umllistview.h:98
UMLListView::dragMoveEvent
void dragMoveEvent(QDragMoveEvent *event)
Definition umllistview.cpp:2873
UMLListView::determineParentItem
UMLListViewItem * determineParentItem(UMLObject *object) const
Definition umllistview.cpp:856
UMLListView::m_doc
UMLDoc * m_doc
Definition umllistview.h:178
UMLListView::slotObjectCreated
void slotObjectCreated(UMLObject *object)
Definition umllistview.cpp:943
UMLListView::operator<<
friend QDebug operator<<(QDebug out, const UMLListView &view)
Definition umllistview.cpp:2946
UMLListView::getDragData
UMLDragData * getDragData()
Definition umllistview.cpp:1240
UMLListView::saveToXMI
void saveToXMI(QXmlStreamWriter &writer)
Definition umllistview.cpp:2438
UMLListView::m_dragStartPosition
QPoint m_dragStartPosition
Definition umllistview.h:182
UMLListView::setStartedCopy
void setStartedCopy(bool startedCopy)
Definition umllistview.cpp:2725
UMLListView::setStartedCut
void setStartedCut(bool startedCut)
Definition umllistview.cpp:2715
UMLListView::m_rv
UMLListViewItem * m_rv
root view (home)
Definition umllistview.h:174
UMLListView::UMLListView
UMLListView(QWidget *parent=0)
Definition umllistview.cpp:89
UMLListView::m_dragCopyData
QMimeData * m_dragCopyData
Definition umllistview.h:183
UMLListView::addAtContainer
void addAtContainer(UMLListViewItem *item, UMLListViewItem *parent)
Definition umllistview.cpp:1601
UMLListView::m_lv
UMLListViewItem * m_lv[Uml::ModelType::N_MODELTYPES]
predefined list view roots
Definition umllistview.h:175
UMLListView::closeDatatypesFolder
void closeDatatypesFolder()
Definition umllistview.cpp:2792
UMLListView::m_findItems
QList< QTreeWidgetItem * > m_findItems
Definition umllistview.h:184
UMLListView::theDatatypeFolder
UMLListViewItem * theDatatypeFolder()
Definition umllistview.h:100
UMLListView::slotObjectChanged
void slotObjectChanged()
Definition umllistview.cpp:1103
UMLListView::setTitle
void setTitle(int column, const QString &text)
Definition umllistview.cpp:147
UMLListView::rootView
UMLListViewItem * rootView(UMLListViewItem::ListViewType type)
Definition umllistview.cpp:2742
UMLListView::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *me)
Definition umllistview.cpp:278
UMLListView::slotDiagramCreated
void slotDiagramCreated(Uml::ID::Type id)
Definition umllistview.cpp:827
UMLListView::selectedItems
UMLListViewItemList selectedItems() const
Definition umllistview.cpp:1970
UMLListView::slotMenuSelection
void slotMenuSelection(QAction *action, const QPoint &position=QPoint())
Definition umllistview.cpp:322
UMLListView::collapseAll
void collapseAll(UMLListViewItem *item)
Definition umllistview.cpp:2701
UMLListView::changeIconOf
void changeIconOf(UMLObject *o, Icon_Utils::IconType to)
Definition umllistview.cpp:1322
UMLListView::m_bStartedCut
bool m_bStartedCut
Definition umllistview.h:179
UMLListView::findUMLObject
UMLListViewItem * findUMLObject(const UMLObject *p) const
Definition umllistview.cpp:1310
UMLListView::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *me)
Definition umllistview.cpp:243
UMLObject
The base class for UML objects.
Definition umlobject.h:70
UMLObject::ObjectType
ObjectType
Definition umlobject.h:76
UMLView
Definition umlview.h:30
v
std::vector< std::string > v
Definition cxx11-initializer-lists.h:19
icon_utils.h
Icon_Utils::IconType
IconType
Definition icon_utils.h:25
Uml::DiagramType::Enum
Enum
Definition basictypes.h:63
Uml::ID::Type
std::string Type
Definition basictypes.h:371
Uml::ModelType::N_MODELTYPES
@ N_MODELTYPES
Definition basictypes.h:33
Uml::ModelType::Logical
@ Logical
Definition basictypes.h:28
Uml::ModelType::UseCase
@ UseCase
Definition basictypes.h:29
Uml::ModelType::Deployment
@ Deployment
Definition basictypes.h:31
Uml::ModelType::Component
@ Component
Definition basictypes.h:30
umllistviewitem.h
umllistviewitemlist.h
UMLListViewItemList
QList< UMLListViewItem * > UMLListViewItemList
Definition umllistviewitemlist.h:14
umlobject.h