• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

umbrello/umbrello

  • sources
  • kde-4.12
  • kdesdk
  • umbrello
  • umbrello
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-2013 *
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 IDChangeLog;
31 class ListPopupMenu;
32 class UMLClassifier;
33 class UMLDoc;
34 class UMLView;
35 class UMLClassifierListItem;
36 class UMLDragData;
37 
48 class UMLListView : public QTreeWidget
49 {
50  Q_OBJECT
51 public:
52  explicit UMLListView(QWidget *parent = 0);
53  ~UMLListView();
54 
55  void setDocument(UMLDoc * doc);
56  UMLDoc * document() const;
57 
58  void init();
59  void clean();
60 
61  void setView(UMLView* view);
62 
63  void setTitle(int column, const QString &text);
64 
65  UMLListViewItemList selectedItems();
66  UMLListViewItemList selectedItemsRoot();
67  int selectedItemsCount();
68 
69  UMLListViewItem* createDiagramItem(UMLView *view);
70 
71  bool createItem(UMLListViewItem *item);
72 
73  UMLListViewItem* findFolderForDiagram(Uml::DiagramType::Enum dt);
74 
75  UMLListViewItem* determineParentItem(UMLObject* object) const;
76  UMLListViewItem* determineParentItem(UMLListViewItem::ListViewType lvt) const;
77 
78  static bool mayHaveChildItems(UMLObject::ObjectType type);
79 
80  void addNewItem(UMLListViewItem * parent, UMLListViewItem::ListViewType type);
81 
82  UMLListViewItem * findUMLObject(const UMLObject *p) const;
83  UMLListViewItem * findView(UMLView *v);
84  UMLListViewItem * findItem(Uml::ID::Type id);
85 
86  UMLListViewItem *rootView(UMLListViewItem::ListViewType type);
87 
88  void changeIconOf(UMLObject *o, Icon_Utils::IconType to);
89 
90  UMLObject *createUMLObject(UMLListViewItem * item, UMLObject::ObjectType type);
91  bool createChildUMLObject(UMLListViewItem * item, UMLObject::ObjectType type);
92  UMLView* createDiagram(UMLListViewItem * item, Uml::DiagramType::Enum type);
93 
94  QString uniqueDiagramName(Uml::DiagramType::Enum type);
95 
96  bool isUnique(UMLListViewItem * item, const QString &name);
97 
98  void setSelected(UMLListViewItem * item, bool state) { setItemSelected((QTreeWidgetItem*)item, state); }
99  void setStartedCut(bool startedCut);
100  void setStartedCopy(bool startedCopy);
101  bool startedCopy() const;
102 
103  UMLListViewItem * moveObject(Uml::ID::Type srcId, UMLListViewItem::ListViewType srcType,
104  UMLListViewItem *newParent);
105 
106  bool itemRenamed(UMLListViewItem* item, int col);
107 
108  void closeDatatypesFolder();
109 
110  UMLListViewItem *theRootView() { return m_rv; }
111  UMLListViewItem *theLogicalView() { return m_lv[Uml::ModelType::Logical]; }
112  UMLListViewItem *theUseCaseView() { return m_lv[Uml::ModelType::UseCase]; }
113  UMLListViewItem *theComponentView() { return m_lv[Uml::ModelType::Component]; }
114  UMLListViewItem *theDeploymentView() { return m_lv[Uml::ModelType::Deployment]; }
115  UMLListViewItem *theDatatypeFolder() { return m_datatypeFolder; }
116 
117  UMLListViewItem::ListViewType rootViewType(UMLListViewItem *item);
118 
119  void saveToXMI(QDomDocument & qDoc, QDomElement & qElement);
120  bool loadFromXMI(QDomElement & element);
121  bool loadChildrenFromXMI(UMLListViewItem * parent, QDomElement & element);
122 
123  friend QDebug operator<<(QDebug out, const UMLListView& view);
124 
125 protected:
126  bool event(QEvent *e);
127  void mouseReleaseEvent(QMouseEvent *me);
128  void mousePressEvent(QMouseEvent *me);
129  void mouseMoveEvent(QMouseEvent *me);
130  void mouseDoubleClickEvent(QMouseEvent *me);
131  void focusOutEvent (QFocusEvent *fe);
132  void contextMenuEvent(QContextMenuEvent *me);
133  UMLDragData* getDragData();
134 
135  bool acceptDrag(QDropEvent* event) const;
136  void keyPressEvent(QKeyEvent* ke);
137  void dragEnterEvent(QDragEnterEvent* event);
138  void dragMoveEvent(QDragMoveEvent* event);
139  void dropEvent(QDropEvent* event);
140  void commitData(QWidget *editor);
141 
142  UMLListViewItem * findUMLObjectInFolder(UMLListViewItem *folder, UMLObject *obj);
143 
144  static bool isExpandable(UMLListViewItem::ListViewType lvt);
145 
146  void deleteChildrenOf(UMLListViewItem *parent);
147 
148  bool deleteItem(UMLListViewItem *temp);
149 
150  void childObjectAdded(UMLClassifierListItem* child, UMLClassifier* parent);
151 
152  void addAtContainer(UMLListViewItem *item, UMLListViewItem *parent);
153 
154 public slots:
155  void slotDiagramCreated(Uml::ID::Type id);
156  void slotDiagramRenamed(Uml::ID::Type id);
157  void slotDiagramRemoved(Uml::ID::Type id);
158  void slotObjectCreated(UMLObject* object);
159  void slotObjectRemoved(UMLObject* object);
160 
161  void connectNewObjectsSlots(UMLObject* object);
162 
163  void childObjectAdded(UMLClassifierListItem* obj);
164  void childObjectRemoved(UMLClassifierListItem* obj);
165 
166  void slotObjectChanged();
167 
168  void slotMenuSelection(QAction* action);
169 
170  void slotDropped(QDropEvent* de, UMLListViewItem* parent, UMLListViewItem* item);
171 
172  void expandAll(UMLListViewItem *item);
173  void collapseAll(UMLListViewItem *item);
174 
175  void slotCutSuccessful();
176  void slotDeleteSelectedItems();
177 
178 protected slots:
179  void slotItemSelectionChanged();
180  void slotExpanded(QTreeWidgetItem* item);
181  void slotCollapsed(QTreeWidgetItem* item);
182 
183 private:
184  UMLListViewItem* recursiveSearchForView(UMLListViewItem* folder,
185  UMLListViewItem::ListViewType type, Uml::ID::Type id);
186 
187  void setBackgroundColor(const QColor & color);
188 
189  UMLListViewItem* m_rv;
190  UMLListViewItem* m_lv[Uml::ModelType::N_MODELTYPES];
191  UMLListViewItem* m_datatypeFolder;
192  UMLDoc* m_doc;
193  bool m_bStartedCut;
194  bool m_bStartedCopy;
195  bool m_bCreatingChildObject;
196  QPoint m_dragStartPosition;
197 };
198 
199 #endif
UMLListView::setStartedCut
void setStartedCut(bool startedCut)
Set the variable m_bStartedCut to indicate that selection should be deleted in slotCutSuccessful().
Definition: umllistview.cpp:2922
UMLListViewItem
Items used by the class UMLListView.
Definition: umllistviewitem.h:38
umlobject.h
UMLListView::commitData
void commitData(QWidget *editor)
Definition: umllistview.cpp:3094
UMLListView::slotDeleteSelectedItems
void slotDeleteSelectedItems()
Delete every selected item.
Definition: umllistview.cpp:2070
UMLClassifier
This class defines the non-graphical information required for a UML Classifier (ie a class or interfa...
Definition: classifier.h:39
UMLListView::slotItemSelectionChanged
void slotItemSelectionChanged()
Handler for item selection changed signals.
Definition: umllistview.cpp:145
UMLListView::createChildUMLObject
bool createChildUMLObject(UMLListViewItem *item, UMLObject::ObjectType type)
Creates a child UMLObject out of the given list view item.
Definition: umllistview.cpp:2356
UMLListView::deleteChildrenOf
void deleteChildrenOf(UMLListViewItem *parent)
Deletes all child-items of parent.
Definition: umllistview.cpp:2984
UMLListView::slotObjectRemoved
void slotObjectRemoved(UMLObject *object)
Disconnects signals and removes the list view item.
Definition: umllistview.cpp:1046
UMLClassifierListItem
Classifiers (classes, interfaces) have lists of operations, attributes, templates and others...
Definition: classifierlistitem.h:29
QTreeWidget
UMLListView::saveToXMI
void saveToXMI(QDomDocument &qDoc, QDomElement &qElement)
Definition: umllistview.cpp:2630
Uml::ModelType::Component
Definition: basictypes.h:41
UMLListView::slotDropped
void slotDropped(QDropEvent *de, UMLListViewItem *parent, UMLListViewItem *item)
Something has been dragged and dropped onto the list view.
Definition: umllistview.cpp:1798
IDChangeLog
This class contains all the ID translations done for each UMLObject pasted.
Definition: idchangelog.h:26
UMLListView::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *me)
Definition: umllistview.cpp:1968
UMLListView::~UMLListView
~UMLListView()
Standard destructor.
Definition: umllistview.cpp:127
UMLView
UMLView instances represent diagrams.
Definition: umlview.h:32
QWidget
UMLListView::findFolderForDiagram
UMLListViewItem * findFolderForDiagram(Uml::DiagramType::Enum dt)
Find the parent folder for a diagram.
Definition: umllistview.cpp:674
UMLListView::clean
void clean()
Remove all items and subfolders of the main folders.
Definition: umllistview.cpp:1284
UMLListView::createDiagram
UMLView * createDiagram(UMLListViewItem *item, Uml::DiagramType::Enum type)
Creates a diagram out of the given list view item.
Definition: umllistview.cpp:2491
UMLListView::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event)
Definition: umllistview.cpp:3059
UMLListView::addAtContainer
void addAtContainer(UMLListViewItem *item, UMLListViewItem *parent)
Auxiliary method for moveObject(): Adds the model object at the proper new container (package if nest...
Definition: umllistview.cpp:1514
UMLListView::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *me)
Event handler for mouse double click.
Definition: umllistview.cpp:1309
UMLListView::selectedItemsRoot
UMLListViewItemList selectedItemsRoot()
Get selected items, but only root elements selected (without children).
Definition: umllistview.cpp:1844
UMLListView::mayHaveChildItems
static bool mayHaveChildItems(UMLObject::ObjectType type)
Return true if the given ObjectType permits child items.
Definition: umllistview.cpp:787
UMLListView::childObjectRemoved
void childObjectRemoved(UMLClassifierListItem *obj)
Deletes the list view item.
Definition: umllistview.cpp:996
UMLListView::determineParentItem
UMLListViewItem * determineParentItem(UMLObject *object) const
Determine the parent ListViewItem given an UMLObject.
Definition: umllistview.cpp:730
UMLListView::findUMLObjectInFolder
UMLListViewItem * findUMLObjectInFolder(UMLListViewItem *folder, UMLObject *obj)
This methods looks for a object in a folder an its subfolders recursive.
Definition: umllistview.cpp:1096
UMLListView::init
void init()
Carries out initalisation of attributes in class.
Definition: umllistview.cpp:1247
UMLListView::UMLListView
UMLListView(QWidget *parent=0)
Constructs the tree view.
Definition: umllistview.cpp:84
UMLListView::dropEvent
void dropEvent(QDropEvent *event)
Definition: umllistview.cpp:3077
UMLListView::slotDiagramRenamed
void slotDiagramRenamed(Uml::ID::Type id)
Renames a diagram in the list view.
Definition: umllistview.cpp:1011
UMLListView::expandAll
void expandAll(UMLListViewItem *item)
Open all items in the list view.
Definition: umllistview.cpp:2896
UMLObject
This class is the non-graphical version of UMLWidget.
Definition: umlobject.h:41
UMLListView::uniqueDiagramName
QString uniqueDiagramName(Uml::DiagramType::Enum type)
Returns a unique name for a diagram.
Definition: umllistview.cpp:2524
UMLListView::focusOutEvent
void focusOutEvent(QFocusEvent *fe)
Event handler for lost focus.
Definition: umllistview.cpp:1956
UMLListView::event
bool event(QEvent *e)
Event handler for the tool tip event.
Definition: umllistview.cpp:167
UMLListView::slotDiagramRemoved
void slotDiagramRemoved(Uml::ID::Type id)
Removes the item representing a diagram.
Definition: umllistview.cpp:1061
UMLListView
This is one of the main classes used in this program.
Definition: umllistview.h:48
UMLListView::setStartedCopy
void setStartedCopy(bool startedCopy)
Set the variable m_bStartedCopy.
Definition: umllistview.cpp:2932
UMLListView::theComponentView
UMLListViewItem * theComponentView()
Definition: umllistview.h:113
UMLListView::theDatatypeFolder
UMLListViewItem * theDatatypeFolder()
Definition: umllistview.h:115
UMLListView::theLogicalView
UMLListViewItem * theLogicalView()
Definition: umllistview.h:111
UMLListView::theUseCaseView
UMLListViewItem * theUseCaseView()
Definition: umllistview.h:112
UMLListView::addNewItem
void addNewItem(UMLListViewItem *parent, UMLListViewItem::ListViewType type)
Adds a new item to the tree of the given type under the given parent.
Definition: umllistview.cpp:2083
Uml::DiagramType::Enum
Enum
Definition: basictypes.h:73
UMLListView::isUnique
bool isUnique(UMLListViewItem *item, const QString &name)
Returns if the given name is unique for the given items type.
Definition: umllistview.cpp:2532
UMLListView::acceptDrag
bool acceptDrag(QDropEvent *event) const
Event handler for accepting drag request.
Definition: umllistview.cpp:1369
UMLListView::closeDatatypesFolder
void closeDatatypesFolder()
Definition: umllistview.cpp:3000
UMLListView::slotCollapsed
void slotCollapsed(QTreeWidgetItem *item)
Calls updateFolder() on the item to update the icon to closed.
Definition: umllistview.cpp:2045
UMLListView::selectedItems
UMLListViewItemList selectedItems()
Get selected items.
Definition: umllistview.cpp:1824
UMLListView::slotCutSuccessful
void slotCutSuccessful()
Connects to the signal that UMLApp emits when a cut operation is successful.
Definition: umllistview.cpp:2057
UMLListView::createItem
bool createItem(UMLListViewItem *item)
Definition: umllistview.cpp:2166
UMLListView::rootView
UMLListViewItem * rootView(UMLListViewItem::ListViewType type)
Returns the corresponding view if the listview type is one of the root views, Root/Logical/UseCase/Co...
Definition: umllistview.cpp:2949
UMLListView::itemRenamed
bool itemRenamed(UMLListViewItem *item, int col)
Called for informing the list view that an item was renamed.
Definition: umllistview.cpp:2130
umllistviewitemlist.h
UMLListView::findItem
UMLListViewItem * findItem(Uml::ID::Type id)
Searches through the tree for the item with the given ID.
Definition: umllistview.cpp:1232
Uml::ModelType::UseCase
Definition: basictypes.h:40
UMLListView::getDragData
UMLDragData * getDragData()
Definition: umllistview.cpp:1071
UMLListView::loadFromXMI
bool loadFromXMI(QDomElement &element)
Definition: umllistview.cpp:2640
UMLListView::createUMLObject
UMLObject * createUMLObject(UMLListViewItem *item, UMLObject::ObjectType type)
Creates a UMLObject out of the given list view item.
Definition: umllistview.cpp:2269
UMLListView::startedCopy
bool startedCopy() const
Return the variable m_bStartedCopy.
Definition: umllistview.cpp:2940
QTreeWidgetItem
Uml::ID::Type
std::string Type
Definition: basictypes.h:317
UMLListView::collapseAll
void collapseAll(UMLListViewItem *item)
Close all items in the list view.
Definition: umllistview.cpp:2908
UMLListView::moveObject
UMLListViewItem * moveObject(Uml::ID::Type srcId, UMLListViewItem::ListViewType srcType, UMLListViewItem *newParent)
Moves an object given is unique ID and listview type to an other listview parent item.
Definition: umllistview.cpp:1543
UMLListView::slotMenuSelection
void slotMenuSelection(QAction *action)
Called when a right mouse button menu has an item selected.
Definition: umllistview.cpp:295
UMLListView::slotDiagramCreated
void slotDiagramCreated(Uml::ID::Type id)
Creates a new item to represent a new diagram.
Definition: umllistview.cpp:705
UMLListView::connectNewObjectsSlots
void connectNewObjectsSlots(UMLObject *object)
Connect some signals into slots in the list view for newly created UMLObjects.
Definition: umllistview.cpp:858
UMLListView::document
UMLDoc * document() const
Returns the document pointer.
Definition: umllistview.cpp:1947
UMLListView::dragMoveEvent
void dragMoveEvent(QDragMoveEvent *event)
Definition: umllistview.cpp:3068
UMLObject::ObjectType
ObjectType
Definition: umlobject.h:47
Uml::ModelType::N_MODELTYPES
Definition: basictypes.h:44
UMLListView::deleteItem
bool deleteItem(UMLListViewItem *temp)
Delete a listview item.
Definition: umllistview.cpp:3010
UMLListView::slotObjectChanged
void slotObjectChanged()
Calls updateObject() on the item representing the sending object no parameters, uses sender() to work...
Definition: umllistview.cpp:935
icon_utils.h
UMLListView::findView
UMLListViewItem * findView(UMLView *v)
Searches through the tree for the item which represents the diagram given.
Definition: umllistview.cpp:1166
UMLListView::setView
void setView(UMLView *view)
Set the current view to the given view.
Definition: umllistview.cpp:1297
UMLListView::isExpandable
static bool isExpandable(UMLListViewItem::ListViewType lvt)
Return true if the given list view type can be expanded/collapsed.
Definition: umllistview.cpp:2015
ListPopupMenu
A popup menu that depending on what type is set to will display a different menu. ...
Definition: listpopupmenu.h:40
UMLListView::operator<<
friend QDebug operator<<(QDebug out, const UMLListView &view)
Overloading operator for debugging output.
Definition: umllistview.cpp:3136
Uml::ModelType::Logical
Definition: basictypes.h:39
UMLListView::findUMLObject
UMLListViewItem * findUMLObject(const UMLObject *p) const
Find an UMLObject in the listview.
Definition: umllistview.cpp:1140
UMLListView::changeIconOf
void changeIconOf(UMLObject *o, Icon_Utils::IconType to)
Changes the icon for the given UMLObject to the given icon.
Definition: umllistview.cpp:1154
UMLListView::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *me)
Handler for mouse move events.
Definition: umllistview.cpp:230
UMLListView::theDeploymentView
UMLListViewItem * theDeploymentView()
Definition: umllistview.h:114
UMLListView::slotExpanded
void slotExpanded(QTreeWidgetItem *item)
Calls updateFolder() on the item to update the icon to open.
Definition: umllistview.cpp:2034
UMLListView::setSelected
void setSelected(UMLListViewItem *item, bool state)
Definition: umllistview.h:98
umllistviewitem.h
UMLListView::setTitle
void setTitle(int column, const QString &text)
Sets the title.
Definition: umllistview.cpp:137
UMLListViewItem::ListViewType
ListViewType
Definition: umllistviewitem.h:41
UMLListView::selectedItemsCount
int selectedItemsCount()
Return the amount of items selected.
Definition: umllistview.cpp:1938
UMLDragData
This class provides encoding and decoding for the uml data that will be used in a drag and drop opera...
Definition: umldragdata.h:36
Icon_Utils::IconType
IconType
Definition: icon_utils.h:38
UMLListView::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *me)
Handler for mouse release event.
Definition: umllistview.cpp:252
QEvent
UMLListViewItemList
QList< UMLListViewItem * > UMLListViewItemList
Definition: umllistviewitemlist.h:24
UMLListView::slotObjectCreated
void slotObjectCreated(UMLObject *object)
Creates a new list view item and connects the appropriate signals/slots.
Definition: umllistview.cpp:807
basictypes.h
Uml::ModelType::Deployment
Definition: basictypes.h:42
UMLListView::mousePressEvent
void mousePressEvent(QMouseEvent *me)
Handler for mouse press events.
Definition: umllistview.cpp:187
UMLListView::theRootView
UMLListViewItem * theRootView()
Definition: umllistview.h:110
UMLListView::setDocument
void setDocument(UMLDoc *doc)
Sets the document his is associated with.
Definition: umllistview.cpp:1028
UMLListView::rootViewType
UMLListViewItem::ListViewType rootViewType(UMLListViewItem *item)
Determines the root listview type of the given UMLListViewItem.
Definition: umllistview.cpp:1992
UMLListView::loadChildrenFromXMI
bool loadChildrenFromXMI(UMLListViewItem *parent, QDomElement &element)
Definition: umllistview.cpp:2667
UMLListView::createDiagramItem
UMLListViewItem * createDiagramItem(UMLView *view)
Create a listview item for an existing diagram.
Definition: umllistview.cpp:1870
UMLListView::childObjectAdded
void childObjectAdded(UMLClassifierListItem *child, UMLClassifier *parent)
Adds a new operation, attribute or template item to a classifier, identical to childObjectAdded(obj) ...
Definition: umllistview.cpp:963
UMLListView::keyPressEvent
void keyPressEvent(QKeyEvent *ke)
Handler for key press events.
Definition: umllistview.cpp:276
UMLDoc
UMLDoc provides a document object for a document-view model.
Definition: umldoc.h:63
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:06:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

umbrello/umbrello

Skip menu "umbrello/umbrello"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal