umbrello: umbrello/umllistview.h Source File

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

umllistview.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2002-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef UMLLISTVIEW_H
12 #define UMLLISTVIEW_H
13
14 #include "basictypes.h"
15 #include "umllistviewitem.h"
16 #include "umllistviewitemlist.h"
17 #include "icon_utils.h"
18 #include "umlobject.h"
19
20 #include <QDomDocument>
21 #include <QDomElement>
22 #include <QTreeWidget>
23 #include <QTreeWidgetItem>
24
25 class QEvent;
26 class QMouseEvent;
27 class QFocusEvent;
28 class QKeyEvent;
29 class QDropEvent;
30 class UMLClassifier;
31 class UMLDoc;
32 class UMLView;
33 class UMLClassifierListItem;
34 class UMLDragData;
35
46 class UMLListView : public QTreeWidget
47 {
48 Q_OBJECT
49 public:
50 explicit UMLListView(QWidget *parent = 0);
51 ~UMLListView();
52
53 void setDocument(UMLDoc * doc);
54 UMLDoc * document() const;
55
56 void init();
57 void clean();
58
59 void setView(UMLView* view);
60
61 void setTitle(int column, const QString &text);
62
63 UMLListViewItemList selectedItems();
64 UMLListViewItemList selectedItemsRoot();
65 int selectedItemsCount();
66
67 UMLListViewItem* createDiagramItem(UMLView *view);
68
69 bool createItem(UMLListViewItem *item);
70
71 UMLListViewItem* findFolderForDiagram(Uml::DiagramType::Enum dt);
72
73 UMLListViewItem* determineParentItem(UMLObject* object) const;
74 UMLListViewItem* determineParentItem(UMLListViewItem::ListViewType lvt) const;
75
76 static bool mayHaveChildItems(UMLObject::ObjectType type);
77
78 void addNewItem(UMLListViewItem * parent, UMLListViewItem::ListViewType type);
79
80 UMLListViewItem * findUMLObject(const UMLObject *p) const;
81 UMLListViewItem * findView(UMLView *v);
82 UMLListViewItem * findItem(Uml::ID::Type id);
83
84 UMLListViewItem *rootView(UMLListViewItem::ListViewType type);
85
86 void changeIconOf(UMLObject *o, Icon_Utils::IconType to);
87
88 bool isUnique(UMLListViewItem * item, const QString &name);
89
90 void setStartedCut(bool startedCut);
91 void setStartedCopy(bool startedCopy);
92 bool startedCopy() const;
93
94 UMLListViewItem * moveObject(Uml::ID::Type srcId, UMLListViewItem::ListViewType srcType,
95 UMLListViewItem *newParent);
96
97 void closeDatatypesFolder();
98
99 UMLListViewItem *theRootView() { return m_rv; }
100 UMLListViewItem *theLogicalView() { return m_lv[Uml::ModelType::Logical]; }
101 UMLListViewItem *theUseCaseView() { return m_lv[Uml::ModelType::UseCase]; }
102 UMLListViewItem *theComponentView() { return m_lv[Uml::ModelType::Component]; }
103 UMLListViewItem *theDeploymentView() { return m_lv[Uml::ModelType::Deployment]; }
104 UMLListViewItem *theDatatypeFolder() { return m_datatypeFolder; }
105
106 UMLListViewItem::ListViewType rootViewType(UMLListViewItem *item);
107
108 void saveToXMI1(QDomDocument & qDoc, QDomElement & qElement);
109 bool loadFromXMI1(QDomElement & element);
110 bool loadChildrenFromXMI(UMLListViewItem * parent, QDomElement & element);
111
112 friend QDebug operator<<(QDebug out, const UMLListView& view);
113
114 protected:
115 bool event(QEvent *e);
116 void mouseReleaseEvent(QMouseEvent *me);
117 void mousePressEvent(QMouseEvent *me);
118 void mouseMoveEvent(QMouseEvent *me);
119 void mouseDoubleClickEvent(QMouseEvent *me);
120 void focusOutEvent (QFocusEvent *fe);
121 void contextMenuEvent(QContextMenuEvent *event);
122 UMLDragData* getDragData();
123
124 bool acceptDrag(QDropEvent* event) const;
125 void keyPressEvent(QKeyEvent* ke);
126 void dragEnterEvent(QDragEnterEvent* event);
127 void dragMoveEvent(QDragMoveEvent* event);
128 void dropEvent(QDropEvent* event);
129 void commitData(QWidget *editor);
130
131 UMLListViewItem * findUMLObjectInFolder(UMLListViewItem *folder, UMLObject *obj);
132
133 static bool isExpandable(UMLListViewItem::ListViewType lvt);
134
135 void deleteChildrenOf(UMLListViewItem *parent);
136
137 bool deleteItem(UMLListViewItem *temp);
138
139 void childObjectAdded(UMLClassifierListItem* child, UMLClassifier* parent);
140
141 void addAtContainer(UMLListViewItem *item, UMLListViewItem *parent);
142
143 public slots:
144 void slotDiagramCreated(Uml::ID::Type id);
145 void slotDiagramRenamed(Uml::ID::Type id);
146 void slotDiagramRemoved(Uml::ID::Type id);
147 void slotObjectCreated(UMLObject* object);
148 void slotObjectRemoved(UMLObject* object);
149
150 void connectNewObjectsSlots(UMLObject* object);
151
152 void childObjectAdded(UMLClassifierListItem* obj);
153 void childObjectRemoved(UMLClassifierListItem* obj);
154
155 void slotObjectChanged();
156
157 void slotMenuSelection(QAction* action, const QPoint &position = QPoint());
158
159 void slotDropped(QDropEvent* de, UMLListViewItem* target);
160
161 void expandAll(UMLListViewItem *item);
162 void collapseAll(UMLListViewItem *item);
163
164 void slotCutSuccessful();
165 void slotDeleteSelectedItems();
166
167 protected slots:
168 void slotItemSelectionChanged();
169 void slotExpanded(QTreeWidgetItem* item);
170 void slotCollapsed(QTreeWidgetItem* item);
171
172 private:
173 UMLListViewItem* recursiveSearchForView(UMLListViewItem* folder,
174 UMLListViewItem::ListViewType type, Uml::ID::Type id);
175
176 void setBackgroundColor(const QColor & color);
177
178 UMLListViewItem* m_rv;
179 UMLListViewItem* m_lv[Uml::ModelType::N_MODELTYPES];
180 UMLListViewItem* m_datatypeFolder;
181 UMLListViewItem* m_settingsFolder;
182 UMLDoc* m_doc;
183 bool m_bStartedCut;
184 bool m_bStartedCopy;
185 bool m_bCreatingChildObject;
186 QPoint m_dragStartPosition;
187 QMimeData* m_dragCopyData;
188 QList<QTreeWidgetItem*> m_findItems;
189 };
190
191 #endif
basictypes.h
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
UMLDoc
Definition: umldoc.h:75
UMLDragData
Definition: umldragdata.h:38
UMLListViewItem
Items used by UMLListView.
Definition: umllistviewitem.h:40
UMLListViewItem::ListViewType
ListViewType
Definition: umllistviewitem.h:43
UMLListView
Displays the list view for the program.
Definition: umllistview.h:47
UMLListView::setDocument
void setDocument(UMLDoc *doc)
Definition: umllistview.cpp:1209
UMLListView::slotDropped
void slotDropped(QDropEvent *de, UMLListViewItem *target)
Definition: umllistview.cpp:1926
UMLListView::theUseCaseView
UMLListViewItem * theUseCaseView()
Definition: umllistview.h:101
UMLListView::slotExpanded
void slotExpanded(QTreeWidgetItem *item)
Definition: umllistview.cpp:2170
UMLListView::setBackgroundColor
void setBackgroundColor(const QColor &color)
Definition: umllistview.cpp:2885
UMLListView::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event)
Definition: umllistview.cpp:2815
UMLListView::findView
UMLListViewItem * findView(UMLView *v)
Definition: umllistview.cpp:1346
UMLListView::loadFromXMI1
bool loadFromXMI1(QDomElement &element)
Definition: umllistview.cpp:2417
UMLListView::document
UMLDoc * document() const
Definition: umllistview.cpp:2084
UMLListView::slotCutSuccessful
void slotCutSuccessful()
Definition: umllistview.cpp:2197
UMLListView::init
void init()
Definition: umllistview.cpp:1427
UMLListView::moveObject
UMLListViewItem * moveObject(Uml::ID::Type srcId, UMLListViewItem::ListViewType srcType, UMLListViewItem *newParent)
Definition: umllistview.cpp:1638
UMLListView::slotItemSelectionChanged
void slotItemSelectionChanged()
Definition: umllistview.cpp:167
UMLListView::theLogicalView
UMLListViewItem * theLogicalView()
Definition: umllistview.h:100
UMLListView::m_settingsFolder
UMLListViewItem * m_settingsFolder
settings root
Definition: umllistview.h:181
UMLListView::slotObjectRemoved
void slotObjectRemoved(UMLObject *object)
Definition: umllistview.cpp:1227
UMLListView::slotDiagramRemoved
void slotDiagramRemoved(Uml::ID::Type id)
Definition: umllistview.cpp:1242
UMLListView::addNewItem
void addNewItem(UMLListViewItem *parent, UMLListViewItem::ListViewType type)
Definition: umllistview.cpp:2223
UMLListView::dropEvent
void dropEvent(QDropEvent *event)
Definition: umllistview.cpp:2837
UMLListView::findFolderForDiagram
UMLListViewItem * findFolderForDiagram(Uml::DiagramType::Enum dt)
Definition: umllistview.cpp:821
UMLListView::slotDiagramRenamed
void slotDiagramRenamed(Uml::ID::Type id)
Definition: umllistview.cpp:1192
UMLListView::theComponentView
UMLListViewItem * theComponentView()
Definition: umllistview.h:102
UMLListView::mayHaveChildItems
static bool mayHaveChildItems(UMLObject::ObjectType type)
Definition: umllistview.cpp:938
UMLListView::loadChildrenFromXMI
bool loadChildrenFromXMI(UMLListViewItem *parent, QDomElement &element)
Definition: umllistview.cpp:2444
UMLListView::m_bStartedCopy
bool m_bStartedCopy
Definition: umllistview.h:184
UMLListView::mousePressEvent
void mousePressEvent(QMouseEvent *me)
Definition: umllistview.cpp:209
UMLListView::deleteItem
bool deleteItem(UMLListViewItem *temp)
Definition: umllistview.cpp:2753
UMLListView::selectedItemsRoot
UMLListViewItemList selectedItemsRoot()
Definition: umllistview.cpp:1980
UMLListView::event
bool event(QEvent *e)
Definition: umllistview.cpp:189
UMLListView::isExpandable
static bool isExpandable(UMLListViewItem::ListViewType lvt)
Definition: umllistview.cpp:2151
UMLListView::keyPressEvent
void keyPressEvent(QKeyEvent *ke)
Definition: umllistview.cpp:310
UMLListView::createDiagramItem
UMLListViewItem * createDiagramItem(UMLView *view)
Definition: umllistview.cpp:2006
UMLListView::acceptDrag
bool acceptDrag(QDropEvent *event) const
Definition: umllistview.cpp:1540
UMLListView::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *event)
Definition: umllistview.cpp:2105
UMLListView::focusOutEvent
void focusOutEvent(QFocusEvent *fe)
Definition: umllistview.cpp:2093
UMLListView::saveToXMI1
void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: umllistview.cpp:2407
UMLListView::slotDeleteSelectedItems
void slotDeleteSelectedItems()
Definition: umllistview.cpp:2210
UMLListView::slotCollapsed
void slotCollapsed(QTreeWidgetItem *item)
Definition: umllistview.cpp:2183
UMLListView::startedCopy
bool startedCopy() const
Definition: umllistview.cpp:2683
UMLListView::recursiveSearchForView
UMLListViewItem * recursiveSearchForView(UMLListViewItem *folder, UMLListViewItem::ListViewType type, Uml::ID::Type id)
Definition: umllistview.cpp:1386
UMLListView::deleteChildrenOf
void deleteChildrenOf(UMLListViewItem *parent)
Definition: umllistview.cpp:2727
UMLListView::findItem
UMLListViewItem * findItem(Uml::ID::Type id)
Definition: umllistview.cpp:1412
UMLListView::m_datatypeFolder
UMLListViewItem * m_datatypeFolder
Definition: umllistview.h:180
UMLListView::setView
void setView(UMLView *view)
Definition: umllistview.cpp:1492
UMLListView::theDeploymentView
UMLListViewItem * theDeploymentView()
Definition: umllistview.h:103
UMLListView::m_bCreatingChildObject
bool m_bCreatingChildObject
when creating an attribute or an operation to stop it adding a second listViewItem
Definition: umllistview.h:185
UMLListView::~UMLListView
~UMLListView()
Definition: umllistview.cpp:146
UMLListView::childObjectAdded
void childObjectAdded(UMLClassifierListItem *child, UMLClassifier *parent)
Definition: umllistview.cpp:1144
UMLListView::connectNewObjectsSlots
void connectNewObjectsSlots(UMLObject *object)
Definition: umllistview.cpp:1030
UMLListView::findUMLObjectInFolder
UMLListViewItem * findUMLObjectInFolder(UMLListViewItem *folder, UMLObject *obj)
Definition: umllistview.cpp:1277
UMLListView::commitData
void commitData(QWidget *editor)
Definition: umllistview.cpp:2853
UMLListView::expandAll
void expandAll(UMLListViewItem *item)
Definition: umllistview.cpp:2639
UMLListView::childObjectRemoved
void childObjectRemoved(UMLClassifierListItem *obj)
Definition: umllistview.cpp:1177
UMLListView::selectedItems
UMLListViewItemList selectedItems()
Definition: umllistview.cpp:1960
UMLListView::clean
void clean()
Definition: umllistview.cpp:1479
UMLListView::rootViewType
UMLListViewItem::ListViewType rootViewType(UMLListViewItem *item)
Definition: umllistview.cpp:2128
UMLListView::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *me)
Definition: umllistview.cpp:1504
UMLListView::createItem
bool createItem(UMLListViewItem *item)
UMLListView::dragMoveEvent
void dragMoveEvent(QDragMoveEvent *event)
Definition: umllistview.cpp:2823
UMLListView::determineParentItem
UMLListViewItem * determineParentItem(UMLObject *object) const
Definition: umllistview.cpp:880
UMLListView::m_doc
UMLDoc * m_doc
Definition: umllistview.h:182
UMLListView::slotObjectCreated
void slotObjectCreated(UMLObject *object)
Definition: umllistview.cpp:959
UMLListView::operator<<
friend QDebug operator<<(QDebug out, const UMLListView &view)
Definition: umllistview.cpp:2895
UMLListView::getDragData
UMLDragData * getDragData()
Definition: umllistview.cpp:1252
UMLListView::isUnique
bool isUnique(UMLListViewItem *item, const QString &name)
Definition: umllistview.cpp:2298
UMLListView::m_dragStartPosition
QPoint m_dragStartPosition
Definition: umllistview.h:186
UMLListView::setStartedCopy
void setStartedCopy(bool startedCopy)
Definition: umllistview.cpp:2675
UMLListView::setStartedCut
void setStartedCut(bool startedCut)
Definition: umllistview.cpp:2665
UMLListView::m_rv
UMLListViewItem * m_rv
root view (home)
Definition: umllistview.h:178
UMLListView::UMLListView
UMLListView(QWidget *parent=0)
Definition: umllistview.cpp:101
UMLListView::m_dragCopyData
QMimeData * m_dragCopyData
Definition: umllistview.h:187
UMLListView::addAtContainer
void addAtContainer(UMLListViewItem *item, UMLListViewItem *parent)
Definition: umllistview.cpp:1609
UMLListView::theRootView
UMLListViewItem * theRootView()
Definition: umllistview.h:99
UMLListView::m_lv
UMLListViewItem * m_lv[Uml::ModelType::N_MODELTYPES]
predefined list view roots
Definition: umllistview.h:179
UMLListView::closeDatatypesFolder
void closeDatatypesFolder()
Definition: umllistview.cpp:2743
UMLListView::m_findItems
QList< QTreeWidgetItem * > m_findItems
Definition: umllistview.h:188
UMLListView::slotObjectChanged
void slotObjectChanged()
Definition: umllistview.cpp:1116
UMLListView::theDatatypeFolder
UMLListViewItem * theDatatypeFolder()
Definition: umllistview.h:104
UMLListView::setTitle
void setTitle(int column, const QString &text)
Definition: umllistview.cpp:159
UMLListView::rootView
UMLListViewItem * rootView(UMLListViewItem::ListViewType type)
Definition: umllistview.cpp:2692
UMLListView::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *me)
Definition: umllistview.cpp:286
UMLListView::slotDiagramCreated
void slotDiagramCreated(Uml::ID::Type id)
Definition: umllistview.cpp:852
UMLListView::slotMenuSelection
void slotMenuSelection(QAction *action, const QPoint &position=QPoint())
Definition: umllistview.cpp:330
UMLListView::collapseAll
void collapseAll(UMLListViewItem *item)
Definition: umllistview.cpp:2651
UMLListView::selectedItemsCount
int selectedItemsCount()
Definition: umllistview.cpp:2075
UMLListView::changeIconOf
void changeIconOf(UMLObject *o, Icon_Utils::IconType to)
Definition: umllistview.cpp:1334
UMLListView::m_bStartedCut
bool m_bStartedCut
Definition: umllistview.h:183
UMLListView::findUMLObject
UMLListViewItem * findUMLObject(const UMLObject *p) const
Definition: umllistview.cpp:1322
UMLListView::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *me)
Definition: umllistview.cpp:252
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
UMLObject::ObjectType
ObjectType
Definition: umlobject.h:80
UMLView
Definition: umlview.h:35
v
std::vector< std::string > v
Definition: cxx11-initializer-lists.h:19
icon_utils.h
Icon_Utils::IconType
IconType
Definition: icon_utils.h:47
Uml::DiagramType::Enum
Enum
Definition: basictypes.h:77
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
Uml::ModelType::N_MODELTYPES
@ N_MODELTYPES
Definition: basictypes.h:47
Uml::ModelType::Logical
@ Logical
Definition: basictypes.h:42
Uml::ModelType::UseCase
@ UseCase
Definition: basictypes.h:43
Uml::ModelType::Deployment
@ Deployment
Definition: basictypes.h:45
Uml::ModelType::Component
@ Component
Definition: basictypes.h:44
umllistviewitem.h
umllistviewitemlist.h
UMLListViewItemList
QList< UMLListViewItem * > UMLListViewItemList
Definition: umllistviewitemlist.h:24
umlobject.h