mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 18:50:52 +01:00
Improve the way how an element is updated in the new element panel.
Now Qet only use the new embbeded collection (XmlElementCollection). No need to reload the old element panel for add a new element created by the new element panel Elements are always imported to the embbeded collection of a project git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4468 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -142,6 +142,30 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::itemAtPath
|
||||
* @param path
|
||||
* @return the item at path or nullptr if doesn't exist
|
||||
*/
|
||||
ElementCollectionItem *ElementCollectionItem::itemAtPath(const QString &path)
|
||||
{
|
||||
QStringList str_list = path.split("/");
|
||||
if (str_list.isEmpty()) return nullptr;
|
||||
|
||||
ElementCollectionItem *match_eci = this;
|
||||
foreach (QString str, str_list) {
|
||||
ElementCollectionItem *eci = match_eci->childWithCollectionName(str);
|
||||
if (!eci) {
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
match_eci = eci;
|
||||
}
|
||||
}
|
||||
|
||||
return match_eci;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::rowForInsertItem
|
||||
* Return the row for insert a new child item to this item with name @collection_name.
|
||||
@@ -396,22 +420,3 @@ void ElementCollectionItem::setBackgroundColor(Qt::GlobalColor color, bool show)
|
||||
m_bg_color = color;
|
||||
m_show_bg_color = show;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::canRemoveContent
|
||||
* @return true if this item can remove the content that he represent
|
||||
* By default return false.
|
||||
*/
|
||||
bool ElementCollectionItem::canRemoveContent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::removeContent
|
||||
* Remove the content that he represent this item (a directory or an element).
|
||||
* This method do nothing and return false. Inherit it, to handle removing
|
||||
* @return true if the content was successfully removed
|
||||
*/
|
||||
bool ElementCollectionItem::removeContent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user