QElectroTech  0.70
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
XmlProjectElementCollectionItem Class Reference

The XmlProjectElementCollectionItem class This class specialise ElementCollectionItem for manage an xml collection embedded in a project. More...

#include <xmlprojectelementcollectionitem.h>

Public Types

enum  { Type = UserType+3 }
 
- Public Types inherited from ElementCollectionItem
enum  { Type = UserType+1 }
 

Public Member Functions

 XmlProjectElementCollectionItem ()
 XmlProjectElementCollectionItem::XmlProjectElementCollectionItem Constructor. More...
 
int type () const override
 
bool isDir () const override
 XmlProjectElementCollectionItem::isDir. More...
 
bool isElement () const override
 XmlProjectElementCollectionItem::isElement. More...
 
QString localName () override
 XmlProjectElementCollectionItem::localName. More...
 
QString name () const override
 XmlProjectElementCollectionItem::name. More...
 
QString collectionPath () const override
 XmlProjectElementCollectionItem::collectionPath. More...
 
virtual QString embeddedPath () const
 XmlProjectElementCollectionItem::embeddedPath. More...
 
bool isCollectionRoot () const override
 XmlProjectElementCollectionItem::isCollectionRoot. More...
 
void addChildAtPath (const QString &collection_name) override
 XmlProjectElementCollectionItem::addChildAtPath Ask to this item item to add a new child with collection name (the child must exist in the xml element collection) More...
 
QETProjectproject () const
 XmlProjectElementCollectionItem::project. More...
 
void setProject (QETProject *project, bool set_data=true, bool hide_element=false)
 XmlProjectElementCollectionItem::setProject Set the project for this item. Use this method for set this item the root of the collection. More...
 
void setUpData () override
 XmlProjectElementCollectionItem::setUpData SetUp the data of this item. More...
 
void setUpIcon () override
 XmlProjectElementCollectionItem::setUpIcon SetUp the icon of this item. Because icon use several memory, we use this method for setup icon instead setUpData. More...
 
- Public Member Functions inherited from ElementCollectionItem
 ElementCollectionItem ()
 ElementCollectionItem::ElementCollectionItem Constructor. More...
 
int type () const override
 
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...
 
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...
 

Private Member Functions

void populate (bool set_data=true, bool hide_element=false)
 XmlProjectElementCollectionItem::populate Create the childs of this item. More...
 
void setXmlElement (const QDomElement &element, QETProject *project, bool set_data=true, bool hide_element=false)
 XmlProjectElementCollectionItem::setXmlElement Set the managed content of this item. More...
 

Private Attributes

QETProjectm_project = nullptr
 
QDomElement m_dom_element
 

Detailed Description

The XmlProjectElementCollectionItem class This class specialise ElementCollectionItem for manage an xml collection embedded in a project.

Definition at line 30 of file xmlprojectelementcollectionitem.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 35 of file xmlprojectelementcollectionitem.h.

Constructor & Destructor Documentation

◆ XmlProjectElementCollectionItem()

XmlProjectElementCollectionItem::XmlProjectElementCollectionItem ( )

Member Function Documentation

◆ addChildAtPath()

void XmlProjectElementCollectionItem::addChildAtPath ( const QString &  collection_name)
overridevirtual

XmlProjectElementCollectionItem::addChildAtPath Ask to this item item to add a new child with collection name (the child must exist in the xml element collection)

Parameters
collection_name: name of the child item to add.

Implements ElementCollectionItem.

Definition at line 136 of file xmlprojectelementcollectionitem.cpp.

References m_dom_element, m_project, ElementCollectionItem::rowForInsertItem(), setUpData(), setXmlElement(), and XmlProjectElementCollectionItem().

◆ collectionPath()

QString XmlProjectElementCollectionItem::collectionPath ( ) const
overridevirtual

◆ embeddedPath()

QString XmlProjectElementCollectionItem::embeddedPath ( ) const
virtual

XmlProjectElementCollectionItem::embeddedPath.

Returns
The embedde path of this item The path is in form : embed://dir/subdir/myElement.elmt

Definition at line 100 of file xmlprojectelementcollectionitem.cpp.

References embeddedPath(), isCollectionRoot(), and name().

Referenced by collectionPath(), embeddedPath(), localName(), setUpData(), and setUpIcon().

◆ isCollectionRoot()

bool XmlProjectElementCollectionItem::isCollectionRoot ( ) const
overridevirtual

XmlProjectElementCollectionItem::isCollectionRoot.

Returns
true if this item represent the root of collection

Implements ElementCollectionItem.

Definition at line 120 of file xmlprojectelementcollectionitem.cpp.

References Type, and type().

Referenced by ElementsCollectionWidget::customContextMenu(), embeddedPath(), localName(), and setUpIcon().

◆ isDir()

bool XmlProjectElementCollectionItem::isDir ( ) const
overridevirtual

XmlProjectElementCollectionItem::isDir.

Returns
true if this item represent a directory

Implements ElementCollectionItem.

Definition at line 34 of file xmlprojectelementcollectionitem.cpp.

References m_dom_element.

Referenced by setUpData(), and setUpIcon().

◆ isElement()

bool XmlProjectElementCollectionItem::isElement ( ) const
overridevirtual

XmlProjectElementCollectionItem::isElement.

Returns
true if this item represent an element

Implements ElementCollectionItem.

Definition at line 44 of file xmlprojectelementcollectionitem.cpp.

References m_dom_element.

Referenced by ElementsCollectionModel::dropMimeData().

◆ localName()

QString XmlProjectElementCollectionItem::localName ( )
overridevirtual

◆ name()

QString XmlProjectElementCollectionItem::name ( ) const
overridevirtual

XmlProjectElementCollectionItem::name.

Returns
The collection name of this item

Implements ElementCollectionItem.

Definition at line 77 of file xmlprojectelementcollectionitem.cpp.

References m_dom_element.

Referenced by embeddedPath().

◆ populate()

void XmlProjectElementCollectionItem::populate ( bool  set_data = true,
bool  hide_element = false 
)
private

◆ project()

QETProject * XmlProjectElementCollectionItem::project ( ) const

XmlProjectElementCollectionItem::project.

Returns
the paretn project of the managed collection

Definition at line 161 of file xmlprojectelementcollectionitem.cpp.

References m_project.

Referenced by setProject(), and setXmlElement().

◆ setProject()

void XmlProjectElementCollectionItem::setProject ( QETProject project,
bool  set_data = true,
bool  hide_element = false 
)

XmlProjectElementCollectionItem::setProject Set the project for this item. Use this method for set this item the root of the collection.

Parameters
project: project to manage the collection
set_data: if true, call setUpData for every child of this item

Definition at line 173 of file xmlprojectelementcollectionitem.cpp.

References QETProject::embeddedElementCollection(), m_dom_element, m_project, populate(), project(), and XmlElementCollection::root().

Referenced by ElementsCollectionModel::addProject().

◆ setUpData()

void XmlProjectElementCollectionItem::setUpData ( )
overridevirtual

◆ setUpIcon()

void XmlProjectElementCollectionItem::setUpIcon ( )
overridevirtual

XmlProjectElementCollectionItem::setUpIcon SetUp the icon of this item. Because icon use several memory, we use this method for setup icon instead setUpData.

Implements ElementCollectionItem.

Definition at line 219 of file xmlprojectelementcollectionitem.cpp.

References embeddedPath(), QET::Icons::Folder, ElementsLocation::icon(), isCollectionRoot(), isDir(), m_project, and QET::Icons::ProjectFileGP.

◆ setXmlElement()

void XmlProjectElementCollectionItem::setXmlElement ( const QDomElement &  element,
QETProject project,
bool  set_data = true,
bool  hide_element = false 
)
private

XmlProjectElementCollectionItem::setXmlElement Set the managed content of this item.

Parameters
element: the dom element (directory or element), to be managed by this item
project: the parent project of managed collection
set_data: if true, call setUpData for every child of this item

Definition at line 276 of file xmlprojectelementcollectionitem.cpp.

References m_dom_element, m_project, populate(), and project().

Referenced by addChildAtPath(), and populate().

◆ type()

int XmlProjectElementCollectionItem::type ( ) const
inlineoverride

Definition at line 36 of file xmlprojectelementcollectionitem.h.

References Type.

Referenced by ElementsCollectionModel::dropMimeData(), and isCollectionRoot().

Member Data Documentation

◆ m_dom_element

QDomElement XmlProjectElementCollectionItem::m_dom_element
private

◆ m_project

QETProject* XmlProjectElementCollectionItem::m_project = nullptr
private

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