umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Public Slots | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
UMLListView Class Reference

Displays the list view for the program. More...

#include <umllistview.h>

Inheritance diagram for UMLListView:
Collaboration diagram for UMLListView:

Public Slots

void slotDiagramCreated (Uml::ID::Type id)
 
void slotDiagramRenamed (Uml::ID::Type id)
 
void slotDiagramRemoved (Uml::ID::Type id)
 
void slotObjectCreated (UMLObject *object)
 
void slotObjectRemoved (UMLObject *object)
 
void connectNewObjectsSlots (UMLObject *object)
 
void childObjectAdded (UMLClassifierListItem *obj)
 
void childObjectRemoved (UMLClassifierListItem *obj)
 
void slotObjectChanged ()
 
void slotMenuSelection (QAction *action, const QPoint &position=QPoint())
 
void slotDropped (QDropEvent *de, UMLListViewItem *target)
 
void expandAll (UMLListViewItem *item)
 
void collapseAll (UMLListViewItem *item)
 
void slotCutSuccessful ()
 
void slotDeleteSelectedItems ()
 

Public Member Functions

 UMLListView (QWidget *parent=0)
 
 ~UMLListView ()
 
void setDocument (UMLDoc *doc)
 
UMLDocdocument () const
 
void init ()
 
void clean ()
 
void setView (UMLView *view)
 
void setTitle (int column, const QString &text)
 
UMLListViewItemList selectedItems () const
 
UMLListViewItemList selectedItemsRoot () const
 
int selectedItemsCount () const
 
UMLListViewItemcreateDiagramItem (UMLView *view)
 
bool createItem (UMLListViewItem *item)
 
UMLListViewItemfindFolderForDiagram (Uml::DiagramType::Enum dt) const
 
UMLListViewItemdetermineParentItem (UMLObject *object) const
 
UMLListViewItemdetermineParentItem (UMLListViewItem::ListViewType lvt) const
 
void addNewItem (UMLListViewItem *parent, UMLListViewItem::ListViewType type)
 
UMLListViewItemfindUMLObject (const UMLObject *p) const
 
UMLListViewItemfindView (UMLView *v)
 
UMLListViewItemfindItem (Uml::ID::Type id)
 
UMLListViewItemrootView (UMLListViewItem::ListViewType type)
 
void changeIconOf (UMLObject *o, Icon_Utils::IconType to)
 
bool isUnique (UMLListViewItem *item, const QString &name) const
 
void setStartedCut (bool startedCut)
 
void setStartedCopy (bool startedCopy)
 
bool startedCopy () const
 
UMLListViewItemmoveObject (Uml::ID::Type srcId, UMLListViewItem::ListViewType srcType, UMLListViewItem *newParent)
 
void closeDatatypesFolder ()
 
UMLListViewItemtheRootView ()
 
UMLListViewItemtheLogicalView ()
 
UMLListViewItemtheUseCaseView ()
 
UMLListViewItemtheComponentView ()
 
UMLListViewItemtheDeploymentView ()
 
UMLListViewItemtheDatatypeFolder ()
 
UMLListViewItem::ListViewType rootViewType (UMLListViewItem *item)
 
void saveToXMI (QXmlStreamWriter &writer)
 
bool loadFromXMI (QDomElement &element)
 
bool loadChildrenFromXMI (UMLListViewItem *parent, QDomElement &element)
 

Static Public Member Functions

static bool mayHaveChildItems (UMLObject::ObjectType type)
 

Protected Slots

void slotItemSelectionChanged ()
 
void slotExpanded (QTreeWidgetItem *item)
 
void slotCollapsed (QTreeWidgetItem *item)
 

Protected Member Functions

bool event (QEvent *e)
 
void mouseReleaseEvent (QMouseEvent *me)
 
void mousePressEvent (QMouseEvent *me)
 
void mouseMoveEvent (QMouseEvent *me)
 
void mouseDoubleClickEvent (QMouseEvent *me)
 
void focusOutEvent (QFocusEvent *fe)
 
void contextMenuEvent (QContextMenuEvent *event)
 
UMLDragDatagetDragData ()
 
bool acceptDrag (QDropEvent *event) const
 
void keyPressEvent (QKeyEvent *ke)
 
void dragEnterEvent (QDragEnterEvent *event)
 
void dragMoveEvent (QDragMoveEvent *event)
 
void dropEvent (QDropEvent *event)
 
void commitData (QWidget *editor)
 
UMLListViewItemfindUMLObjectInFolder (UMLListViewItem *folder, UMLObject *obj)
 
void deleteChildrenOf (UMLListViewItem *parent)
 
bool deleteItem (UMLListViewItem *temp)
 
void childObjectAdded (UMLClassifierListItem *child, UMLClassifier *parent)
 
void addAtContainer (UMLListViewItem *item, UMLListViewItem *parent)
 

Static Protected Member Functions

static bool isExpandable (UMLListViewItem::ListViewType lvt)
 

Private Member Functions

UMLListViewItemrecursiveSearchForView (UMLListViewItem *folder, UMLListViewItem::ListViewType type, Uml::ID::Type id)
 
void setBackgroundColor (const QColor &color)
 

Private Attributes

UMLListViewItemm_rv
 root view (home) More...
 
UMLListViewItemm_lv [Uml::ModelType::N_MODELTYPES]
 predefined list view roots More...
 
UMLListViewItemm_datatypeFolder
 
UMLListViewItemm_settingsFolder
 settings root More...
 
UMLDocm_doc
 
bool m_bStartedCut
 
bool m_bStartedCopy
 
bool m_bCreatingChildObject
 when creating an attribute or an operation to stop it adding a second listViewItem More...
 
QPoint m_dragStartPosition
 
QMimeData * m_dragCopyData
 
QList< QTreeWidgetItem * > m_findItems
 

Friends

QDebug operator<< (QDebug out, const UMLListView &view)
 

Detailed Description

Displays the list view for the program.

This is one of the main classes used in this program. Information is displayed here in a tree view. No objects are created here. A call to UMLDoc make any additions/deletion or updates to objects. This class will then wait for a signal before updating the tree view.

Author
Paul Hensgen phens.nosp@m.gen@.nosp@m.techi.nosp@m.e.co.nosp@m.m Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

Constructor & Destructor Documentation

◆ UMLListView()

UMLListView::UMLListView ( QWidget *  parent = 0)
explicit

Constructs the tree view.

Parameters
parentThe parent to this.
Here is the call graph for this function:

◆ ~UMLListView()

UMLListView::~UMLListView ( )

Standard destructor.

Here is the call graph for this function:

Member Function Documentation

◆ acceptDrag()

bool UMLListView::acceptDrag ( QDropEvent *  event) const
protected

Event handler for accepting drag request.

Parameters
eventthe drop event
Returns
success state
Here is the call graph for this function:

◆ addAtContainer()

void UMLListView::addAtContainer ( UMLListViewItem item,
UMLListViewItem parent 
)
protected

Auxiliary method for moveObject(): Adds the model object at the proper new container (package if nested, UMLDoc if at global level), and updates the containment relationships in the model.

Here is the call graph for this function:

◆ addNewItem()

void UMLListView::addNewItem ( UMLListViewItem parentItem,
UMLListViewItem::ListViewType  type 
)

Adds a new item to the tree of the given type under the given parent. Method will take care of signalling anyone needed on creation of new item. e.g. UMLDoc if a UMLObject is created.

Here is the call graph for this function:

◆ changeIconOf()

void UMLListView::changeIconOf ( UMLObject o,
Icon_Utils::IconType  to 
)

Changes the icon for the given UMLObject to the given icon.

Here is the call graph for this function:

◆ childObjectAdded() [1/2]

void UMLListView::childObjectAdded ( UMLClassifierListItem child,
UMLClassifier parent 
)
protected

Adds a new operation, attribute or template item to a classifier, identical to childObjectAdded(obj) but with an explicit parent.

Parameters
childthe child object
parentthe parent object
Here is the call graph for this function:

◆ childObjectAdded [2/2]

void UMLListView::childObjectAdded ( UMLClassifierListItem obj)
slot

Adds a new operation, attribute or template item to a classifier.

Parameters
objthe child object
Here is the call graph for this function:

◆ childObjectRemoved

void UMLListView::childObjectRemoved ( UMLClassifierListItem obj)
slot

Deletes the list view item.

Parameters
objthe object to remove
Here is the call graph for this function:

◆ clean()

void UMLListView::clean ( )

Remove all items and subfolders of the main folders. Special case: The datatype folder, child of the logical view, is not deleted.

Here is the call graph for this function:

◆ closeDatatypesFolder()

void UMLListView::closeDatatypesFolder ( )
Here is the call graph for this function:

◆ collapseAll

void UMLListView::collapseAll ( UMLListViewItem item)
slot

Close all items in the list view.

Here is the call graph for this function:

◆ commitData()

void UMLListView::commitData ( QWidget *  editor)
protected
Here is the call graph for this function:

◆ connectNewObjectsSlots

void UMLListView::connectNewObjectsSlots ( UMLObject object)
slot

Connect some signals into slots in the list view for newly created UMLObjects.

Here is the call graph for this function:

◆ contextMenuEvent()

void UMLListView::contextMenuEvent ( QContextMenuEvent *  event)
protected
Here is the call graph for this function:

◆ createDiagramItem()

UMLListViewItem * UMLListView::createDiagramItem ( UMLView view)

Create a listview item for an existing diagram.

Parameters
viewThe existing diagram.
Here is the call graph for this function:

◆ createItem()

bool UMLListView::createItem ( UMLListViewItem item)

◆ deleteChildrenOf()

void UMLListView::deleteChildrenOf ( UMLListViewItem parent)
protected

Deletes all child-items of parent. Do it in reverse order, because of the index.

◆ deleteItem()

bool UMLListView::deleteItem ( UMLListViewItem temp)
protected

Delete a listview item.

Parameters
tempa non-null UMLListViewItem, for example: (UMLListViewItem*)currentItem()
Returns
true if correctly deleted
Here is the call graph for this function:

◆ determineParentItem() [1/2]

UMLListViewItem * UMLListView::determineParentItem ( UMLListViewItem::ListViewType  lvt) const

Determine the parent ListViewItem given a ListViewType. This parent is used for creating new UMLListViewItems.

Parameters
lvtThe ListViewType for which to lookup the parent.
Returns
Pointer to the parent UMLListViewItem chosen.
Here is the call graph for this function:

◆ determineParentItem() [2/2]

UMLListViewItem * UMLListView::determineParentItem ( UMLObject object) const

Determine the parent ListViewItem given a UMLObject.

Parameters
objectPointer to the UMLObject for which to look up the parent.
Returns
Pointer to the parent UMLListViewItem chosen. Returns NULL on error (no parent could be determined.)
Here is the call graph for this function:

◆ document()

UMLDoc * UMLListView::document ( ) const

Returns the document pointer. Called by the UMLListViewItem class.

◆ dragEnterEvent()

void UMLListView::dragEnterEvent ( QDragEnterEvent *  event)
protected

Always allow starting a drag

◆ dragMoveEvent()

void UMLListView::dragMoveEvent ( QDragMoveEvent *  event)
protected

Check drag destination and update move/copy action

Here is the call graph for this function:

◆ dropEvent()

void UMLListView::dropEvent ( QDropEvent *  event)
protected
Here is the call graph for this function:

◆ event()

bool UMLListView::event ( QEvent *  e)
protected

Event handler for the tool tip event. Works only for operations to show the signature.

Here is the call graph for this function:

◆ expandAll

void UMLListView::expandAll ( UMLListViewItem item)
slot

Open all items in the list view.

Here is the call graph for this function:

◆ findFolderForDiagram()

UMLListViewItem * UMLListView::findFolderForDiagram ( Uml::DiagramType::Enum  dt) const

Find the parent folder for a diagram. If the currently selected item in the list view is a folder then that folder is returned as the parent.

Parameters
dtThe Diagram_Type of the diagram. The type will only be used if there is no currently selected item, or if the current item is not a folder. In that case the root folder which is suitable for the Diagram_Type is returned.
Returns
Pointer to the parent UMLListViewItem for the diagram.
Here is the call graph for this function:

◆ findItem()

UMLListViewItem * UMLListView::findItem ( Uml::ID::Type  id)

Searches through the tree for the item with the given ID.

Parameters
idThe ID to search for.
Returns
The item with the given ID or 0 if not found.
Here is the call graph for this function:

◆ findUMLObject()

UMLListViewItem * UMLListView::findUMLObject ( const UMLObject p) const

Find a UMLObject in the listview.

Parameters
pPointer to the object to find in the list view.
Returns
Pointer to the UMLObject found or NULL if not found.
Here is the call graph for this function:

◆ findUMLObjectInFolder()

UMLListViewItem * UMLListView::findUMLObjectInFolder ( UMLListViewItem folder,
UMLObject obj 
)
protected

This method looks for an object in a folder an its subfolders recursively.

Parameters
folderThe folder entry of the list view.
objThe object to be found in the folder.
Returns
The object if found else a NULL pointer.
Here is the call graph for this function:

◆ findView()

UMLListViewItem * UMLListView::findView ( UMLView v)

Searches through the tree for the item which represents the diagram given.

Parameters
vthe diagram to search for
Returns
the item which represents the diagram
Here is the call graph for this function:

◆ focusOutEvent()

void UMLListView::focusOutEvent ( QFocusEvent *  fe)
protected

Event handler for lost focus.

Parameters
fethe focus event

◆ getDragData()

UMLDragData * UMLListView::getDragData ( )
protected
Here is the call graph for this function:

◆ init()

void UMLListView::init ( )

Carries out initalisation of attributes in class. This method is called more than once during an instance's lifetime (by UMLDoc)! So we must not allocate any memory before freeing the previously allocated one or do connect()s.

Here is the call graph for this function:

◆ isExpandable()

bool UMLListView::isExpandable ( UMLListViewItem::ListViewType  lvt)
staticprotected

Return true if the given list view type can be expanded/collapsed.

Here is the call graph for this function:

◆ isUnique()

bool UMLListView::isUnique ( UMLListViewItem item,
const QString &  name 
) const

Returns if the given name is unique for the given items type.

Here is the call graph for this function:

◆ keyPressEvent()

void UMLListView::keyPressEvent ( QKeyEvent *  ke)
protected

Handler for key press events.

Parameters
kethe key event
Here is the call graph for this function:

◆ loadChildrenFromXMI()

bool UMLListView::loadChildrenFromXMI ( UMLListViewItem parent,
QDomElement &  element 
)
Here is the call graph for this function:

◆ loadFromXMI()

bool UMLListView::loadFromXMI ( QDomElement &  element)
Here is the call graph for this function:

◆ mayHaveChildItems()

bool UMLListView::mayHaveChildItems ( UMLObject::ObjectType  type)
static

Return true if the given ObjectType permits child items. A "child item" is anything that qualifies as a UMLClassifierListItem, e.g. operations and attributes of classifiers.

◆ mouseDoubleClickEvent()

void UMLListView::mouseDoubleClickEvent ( QMouseEvent *  me)
protected

Event handler for mouse double click.

Here is the call graph for this function:

◆ mouseMoveEvent()

void UMLListView::mouseMoveEvent ( QMouseEvent *  me)
protected

Handler for mouse move events.

Parameters
methe mouse event
Here is the call graph for this function:

◆ mousePressEvent()

void UMLListView::mousePressEvent ( QMouseEvent *  me)
protected

Handler for mouse press events.

Parameters
methe mouse event
Here is the call graph for this function:

◆ mouseReleaseEvent()

void UMLListView::mouseReleaseEvent ( QMouseEvent *  me)
protected

Handler for mouse release event.

Parameters
methe mouse event
Here is the call graph for this function:

◆ moveObject()

UMLListViewItem * UMLListView::moveObject ( Uml::ID::Type  srcId,
UMLListViewItem::ListViewType  srcType,
UMLListViewItem newParent 
)

Moves an object given its unique ID and listview type to an other listview parent item. Also takes care of the corresponding move in the model.

Here is the call graph for this function:

◆ recursiveSearchForView()

UMLListViewItem * UMLListView::recursiveSearchForView ( UMLListViewItem listViewItem,
UMLListViewItem::ListViewType  type,
Uml::ID::Type  id 
)
private

Searches the tree for a diagram (view). Warning: these method may return in some cases the wrong diagram Used by findView().

Here is the call graph for this function:

◆ rootView()

UMLListViewItem * UMLListView::rootView ( UMLListViewItem::ListViewType  type)

Returns the corresponding view if the listview type is one of the root views, Root/Logical/UseCase/Component/Deployment/EntityRelation View.

◆ rootViewType()

UMLListViewItem::ListViewType UMLListView::rootViewType ( UMLListViewItem item)

Determines the root listview type of the given UMLListViewItem. Starts at the given item, compares it against each of the predefined root views (Root, Logical, UseCase, Component, Deployment, EntityRelationship.) Returns the ListViewType of the matching root view; if no match then continues the search using the item's parent, then grandparent, and so forth. Returns UMLListViewItem::lvt_Unknown if no match at all is found.

Here is the call graph for this function:

◆ saveToXMI()

void UMLListView::saveToXMI ( QXmlStreamWriter &  writer)
Here is the call graph for this function:

◆ selectedItems()

UMLListViewItemList UMLListView::selectedItems ( ) const

Get selected items.

Returns
the list of selected items

◆ selectedItemsCount()

int UMLListView::selectedItemsCount ( ) const

Return the amount of items selected.

Here is the call graph for this function:

◆ selectedItemsRoot()

UMLListViewItemList UMLListView::selectedItemsRoot ( ) const

Get selected items, but only root elements selected (without children).

Returns
the list of selected root items

◆ setBackgroundColor()

void UMLListView::setBackgroundColor ( const QColor &  color)
private

Set the background color.

Parameters
colorthe new background color

◆ setDocument()

void UMLListView::setDocument ( UMLDoc doc)

Sets the document this is associated with. This is important as this is required as to set up the callbacks.

Parameters
docThe document to associate with this class.
Here is the call graph for this function:

◆ setStartedCopy()

void UMLListView::setStartedCopy ( bool  startedCopy)

Set the variable m_bStartedCopy. NB: While m_bStartedCut is reset as soon as the Cut operation is done, the variable m_bStartedCopy is reset much later - upon pasting.

Here is the call graph for this function:

◆ setStartedCut()

void UMLListView::setStartedCut ( bool  startedCut)

Set the variable m_bStartedCut to indicate that selection should be deleted in slotCutSuccessful().

◆ setTitle()

void UMLListView::setTitle ( int  column,
const QString &  text 
)

Sets the title.

Parameters
columncolumn in which to write
textthe text to write

◆ setView()

void UMLListView::setView ( UMLView view)

Set the current view to the given view.

Parameters
viewThe current view.
Here is the call graph for this function:

◆ slotCollapsed

void UMLListView::slotCollapsed ( QTreeWidgetItem *  item)
protectedslot

Calls updateFolder() on the item to update the icon to closed.

Here is the call graph for this function:

◆ slotCutSuccessful

void UMLListView::slotCutSuccessful ( )
slot

Connects to the signal that UMLApp emits when a cut operation is successful.

Here is the call graph for this function:

◆ slotDeleteSelectedItems

void UMLListView::slotDeleteSelectedItems ( )
slot

Delete every selected item

Here is the call graph for this function:

◆ slotDiagramCreated

void UMLListView::slotDiagramCreated ( Uml::ID::Type  id)
slot

Creates a new item to represent a new diagram.

Parameters
idthe id of the new diagram
Here is the call graph for this function:

◆ slotDiagramRemoved

void UMLListView::slotDiagramRemoved ( Uml::ID::Type  id)
slot

Removes the item representing a diagram.

Parameters
idthe id of the diagram
Here is the call graph for this function:

◆ slotDiagramRenamed

void UMLListView::slotDiagramRenamed ( Uml::ID::Type  id)
slot

Renames a diagram in the list view

Parameters
idthe id of the renamed diagram
Here is the call graph for this function:

◆ slotDropped

void UMLListView::slotDropped ( QDropEvent *  de,
UMLListViewItem target 
)
slot

Something has been dragged and dropped onto the list view.

Here is the call graph for this function:

◆ slotExpanded

void UMLListView::slotExpanded ( QTreeWidgetItem *  item)
protectedslot

Calls updateFolder() on the item to update the icon to open.

Here is the call graph for this function:

◆ slotItemSelectionChanged

void UMLListView::slotItemSelectionChanged ( )
protectedslot

Handler for item selection changed signals.

Here is the call graph for this function:

◆ slotMenuSelection

void UMLListView::slotMenuSelection ( QAction *  action,
const QPoint &  position = QPoint() 
)
slot

Called when a right mouse button menu has an item selected.

Parameters
actionthe selected action
positionthe position of the menu on the diagram (only used for multi selection "Show")

◆ slotObjectChanged

void UMLListView::slotObjectChanged ( )
slot

Calls updateObject() on the item representing the sending object no parameters, uses sender() to work out which object called the slot.

Here is the call graph for this function:

◆ slotObjectCreated

void UMLListView::slotObjectCreated ( UMLObject object)
slot

Creates a new list view item and connects the appropriate signals/slots.

Parameters
objectthe newly created object
Here is the call graph for this function:

◆ slotObjectRemoved

void UMLListView::slotObjectRemoved ( UMLObject object)
slot

Disconnects signals and removes the list view item.

Parameters
objectthe object about to be removed
Here is the call graph for this function:

◆ startedCopy()

bool UMLListView::startedCopy ( ) const

Return the variable m_bStartedCopy.

◆ theComponentView()

UMLListViewItem * UMLListView::theComponentView ( )
inline

◆ theDatatypeFolder()

UMLListViewItem * UMLListView::theDatatypeFolder ( )
inline

◆ theDeploymentView()

UMLListViewItem * UMLListView::theDeploymentView ( )
inline

◆ theLogicalView()

UMLListViewItem * UMLListView::theLogicalView ( )
inline

◆ theRootView()

UMLListViewItem * UMLListView::theRootView ( )
inline

◆ theUseCaseView()

UMLListViewItem * UMLListView::theUseCaseView ( )
inline

Friends And Related Function Documentation

◆ operator<<

QDebug operator<< ( QDebug  out,
const UMLListView view 
)
friend

Overloading operator for debugging output.

Member Data Documentation

◆ m_bCreatingChildObject

bool UMLListView::m_bCreatingChildObject
private

when creating an attribute or an operation to stop it adding a second listViewItem

◆ m_bStartedCopy

bool UMLListView::m_bStartedCopy
private

◆ m_bStartedCut

bool UMLListView::m_bStartedCut
private

◆ m_datatypeFolder

UMLListViewItem* UMLListView::m_datatypeFolder
private

◆ m_doc

UMLDoc* UMLListView::m_doc
private

◆ m_dragCopyData

QMimeData* UMLListView::m_dragCopyData
private

◆ m_dragStartPosition

QPoint UMLListView::m_dragStartPosition
private

◆ m_findItems

QList<QTreeWidgetItem*> UMLListView::m_findItems
private

◆ m_lv

UMLListViewItem* UMLListView::m_lv[Uml::ModelType::N_MODELTYPES]
private

predefined list view roots

◆ m_rv

UMLListViewItem* UMLListView::m_rv
private

root view (home)

◆ m_settingsFolder

UMLListViewItem* UMLListView::m_settingsFolder
private

settings root


The documentation for this class was generated from the following files: