mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 09:40:52 +01:00
xmlElementCollection : collection can add new item.
elementsCollectionModel : Up to date the content when a new item is added to the embedded collection of a project. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4312 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -81,6 +81,20 @@ ElementCollectionItem *ElementCollectionItem::child(int row) {
|
||||
return m_child_items.value(row);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::childWithCollectionName
|
||||
* Return the child with the collection name @name, else return nullptr
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
ElementCollectionItem *ElementCollectionItem::childWithCollectionName(QString name) const
|
||||
{
|
||||
foreach (ElementCollectionItem *eci, m_child_items)
|
||||
if (eci->collectionName() == name) return eci;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::childCount
|
||||
* @return the number of childs of this item
|
||||
@@ -167,6 +181,14 @@ QString ElementCollectionItem::name() {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::collectionName
|
||||
* @return The collection name of this item
|
||||
*/
|
||||
QString ElementCollectionItem::collectionName() const {
|
||||
return QString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::isDir
|
||||
* @return true if this item represent a directory
|
||||
@@ -205,6 +227,43 @@ QList<ElementCollectionItem *> ElementCollectionItem::items() const
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::elementsChild
|
||||
* @return All elements child of this item
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementCollectionItem::elementsChild() const
|
||||
{
|
||||
QList<ElementCollectionItem *> list;
|
||||
foreach (ElementCollectionItem *eci, m_child_items)
|
||||
if (eci->isElement())
|
||||
list.append(eci);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::directoriesChild
|
||||
* @return All directories child of this item
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementCollectionItem::directoriesChild() const
|
||||
{
|
||||
QList<ElementCollectionItem *> list;
|
||||
foreach (ElementCollectionItem *eci, m_child_items)
|
||||
if (eci->isDir())
|
||||
list.append(eci);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::indexOfChild
|
||||
* @param child
|
||||
* @return the index of child or -1 if not found
|
||||
*/
|
||||
int ElementCollectionItem::indexOfChild(ElementCollectionItem *child) const {
|
||||
return m_child_items.indexOf(child);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::canRemoveContent
|
||||
* @return true if this item can remove the content that he represent
|
||||
|
||||
Reference in New Issue
Block a user