QElectroTech  0.70
Public Types | Public Member Functions | List of all members
ElementCollectionItem Class Referenceabstract

The ElementCollectionItem class This class represent a item (a directory or an element) in a element collection. This class must be herited for specialisation. This item is used by ElementsCollectionModel for manage the elements collection. More...

#include <elementcollectionitem.h>

Public Types

enum  { Type = UserType+1 }
 

Public Member Functions

 ElementCollectionItem ()
 ElementCollectionItem::ElementCollectionItem Constructor. More...
 
int type () const override
 
virtual bool isDir () const =0
 
virtual bool isElement () const =0
 
virtual QString localName ()=0
 
virtual QString name () const =0
 
virtual QString collectionPath () const =0
 
virtual bool isCollectionRoot () const =0
 
virtual void addChildAtPath (const QString &collection_name)=0
 
virtual void setUpData ()=0
 
virtual void setUpIcon ()=0
 
virtual void clearData ()
 ElementCollectionItem::clearData Reset the data. More...
 
ElementCollectionItemlastItemForPath (const QString &path, QString &no_found_path)
 ElementCollectionItem::lastItemForPath Return the last existing item in this ElementCollectionItem hierarchy according to the given path. Next_item is the first non existing item in this hierarchy according to the given path. More...
 
, else return nullptr

ElementCollectionItem::childWithCollectionName Return the child with the collection name

Parameters
name
Returns
ElementCollectionItemchildWithCollectionName (const QString &name) const
 
QList< QStandardItem * > directChilds () const
 ElementCollectionItem::directChilds Return the direct child of this item. More...
 
int rowForInsertItem (const QString &name)
 ElementCollectionItem::rowForInsertItem Return the row for insert a new child item to this item with name . If row can't be found (collection_name is null, or already exist) return -1;. More...
 
ElementCollectionItemitemAtPath (const QString &path)
 ElementCollectionItem::itemAtPath. More...
 
QList< ElementCollectionItem * > elementsDirectChild () const
 ElementCollectionItem::elementsDirectChild. More...
 
QList< ElementCollectionItem * > directoriesDirectChild () const
 ElementCollectionItem::directoriesDirectChild. More...
 
QList< ElementCollectionItem * > elementsChild () const
 ElementCollectionItem::elementsChild. More...
 
QList< ElementCollectionItem * > directoriesChild () const
 ElementCollectionItem::directoriesChild. More...
 
QList< ElementCollectionItem * > items () const
 ElementCollectionItem::items. More...
 

Detailed Description

The ElementCollectionItem class This class represent a item (a directory or an element) in a element collection. This class must be herited for specialisation. This item is used by ElementsCollectionModel for manage the elements collection.

Definition at line 29 of file elementcollectionitem.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 34 of file elementcollectionitem.h.

Constructor & Destructor Documentation

◆ ElementCollectionItem()

ElementCollectionItem::ElementCollectionItem ( )

Member Function Documentation

◆ addChildAtPath()

virtual void ElementCollectionItem::addChildAtPath ( const QString &  collection_name)
pure virtual

◆ childWithCollectionName()

ElementCollectionItem * ElementCollectionItem::childWithCollectionName ( const QString &  name) const

Definition at line 75 of file elementcollectionitem.cpp.

References directChilds(), and name().

Referenced by itemAtPath(), and lastItemForPath().

◆ clearData()

void ElementCollectionItem::clearData ( )
virtual

◆ collectionPath()

virtual QString ElementCollectionItem::collectionPath ( ) const
pure virtual

◆ directChilds()

QList< QStandardItem * > ElementCollectionItem::directChilds ( ) const

ElementCollectionItem::directChilds Return the direct child of this item.

Returns

Definition at line 92 of file elementcollectionitem.cpp.

Referenced by childWithCollectionName(), directoriesDirectChild(), and elementsDirectChild().

◆ directoriesChild()

QList< ElementCollectionItem * > ElementCollectionItem::directoriesChild ( ) const

ElementCollectionItem::directoriesChild.

Returns
Every directories child (direct and indirect) of this item

Definition at line 214 of file elementcollectionitem.cpp.

References directoriesChild(), and directoriesDirectChild().

Referenced by directoriesChild(), ElementsCollectionWidget::dirProperties(), and elementsChild().

◆ directoriesDirectChild()

QList< ElementCollectionItem * > ElementCollectionItem::directoriesDirectChild ( ) const

ElementCollectionItem::directoriesDirectChild.

Returns
the direct directory child of this item

Definition at line 183 of file elementcollectionitem.cpp.

References directChilds(), and isDir().

Referenced by directoriesChild(), and rowForInsertItem().

◆ elementsChild()

QList< ElementCollectionItem * > ElementCollectionItem::elementsChild ( ) const

ElementCollectionItem::elementsChild.

Returns
Every elements child (direct and indirect) of this item

Definition at line 200 of file elementcollectionitem.cpp.

References directoriesChild(), and elementsDirectChild().

Referenced by ElementsCollectionWidget::dirProperties().

◆ elementsDirectChild()

QList< ElementCollectionItem * > ElementCollectionItem::elementsDirectChild ( ) const

ElementCollectionItem::elementsDirectChild.

Returns
The direct element child of this item

Definition at line 166 of file elementcollectionitem.cpp.

References directChilds(), and isElement().

Referenced by elementsChild(), and rowForInsertItem().

◆ isCollectionRoot()

virtual bool ElementCollectionItem::isCollectionRoot ( ) const
pure virtual

◆ isDir()

virtual bool ElementCollectionItem::isDir ( ) const
pure virtual

◆ isElement()

virtual bool ElementCollectionItem::isElement ( ) const
pure virtual

◆ itemAtPath()

ElementCollectionItem * ElementCollectionItem::itemAtPath ( const QString &  path)

ElementCollectionItem::itemAtPath.

Parameters
path
Returns
the item at path or nullptr if doesn't exist

Definition at line 144 of file elementcollectionitem.cpp.

References childWithCollectionName().

Referenced by ElementsCollectionModel::indexFromLocation().

◆ items()

QList< ElementCollectionItem * > ElementCollectionItem::items ( ) const

ElementCollectionItem::items.

Returns
every childs of this item (direct and indirect childs)

Definition at line 230 of file elementcollectionitem.cpp.

References items().

Referenced by ElementsCollectionModel::items(), items(), and ElementsCollectionModel::projectItems().

◆ lastItemForPath()

ElementCollectionItem * ElementCollectionItem::lastItemForPath ( const QString &  path,
QString &  no_found_path 
)

ElementCollectionItem::lastItemForPath Return the last existing item in this ElementCollectionItem hierarchy according to the given path. Next_item is the first non existing item in this hierarchy according to the given path.

Parameters
path: The path to find last item. The path must be in form : path/otherPath/.../.../myElement.elmt.
no_found_path: The first item that not exist in this hierarchy
Returns
: The last item that exist in this hierarchy, or nullptr can't find (an error was occurred, or path already exist)

Definition at line 48 of file elementcollectionitem.cpp.

References childWithCollectionName().

Referenced by ElementsCollectionModel::addLocation(), and ElementsCollectionModel::elementIntegratedToCollection().

◆ localName()

virtual QString ElementCollectionItem::localName ( )
pure virtual

◆ name()

virtual QString ElementCollectionItem::name ( ) const
pure virtual

◆ rowForInsertItem()

int ElementCollectionItem::rowForInsertItem ( const QString &  name)

ElementCollectionItem::rowForInsertItem Return the row for insert a new child item to this item with name . If row can't be found (collection_name is null, or already exist) return -1;.

Parameters
collection_name
Returns

Definition at line 109 of file elementcollectionitem.cpp.

References directoriesDirectChild(), elementsDirectChild(), and name().

Referenced by XmlProjectElementCollectionItem::addChildAtPath(), and FileElementCollectionItem::addChildAtPath().

◆ setUpData()

virtual void ElementCollectionItem::setUpData ( )
pure virtual

◆ setUpIcon()

virtual void ElementCollectionItem::setUpIcon ( )
pure virtual

◆ type()

int ElementCollectionItem::type ( ) const
inlineoverride

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