/*! * \brief Remove the item from the tree * * \param item Item to be removed * \param deleteNode Also delete the node from the tree? Modifies the tree. * * \return True if successful */ void MythUIButtonTree::RemoveItem(MythUIButtonListItem *item, bool deleteNode) { if (!item || !m_rootNode) return; MythGenericTree *node = qVariantValue<MythGenericTree *>(item->GetData()); if (node && node->getParent()) { DoSetCurrentNode(node->getParent()); if (deleteNode) node->getParent()->deleteNode(node); else node->SetVisible(false); } MythUIButtonList *list = item->parent(); list->RemoveItem(item); if (list->IsEmpty()) { if (m_currentDepth > 0) m_currentDepth--; else if (m_activeListID > 1) m_activeListID--; SetTreeState(true); } }
QList<MythGenericTree*> MythGenericTree::getRoute(void) { QList<MythGenericTree*> route; route.push_front(this); MythGenericTree *parent = this; while( (parent = parent->getParent()) ) { route.push_front(parent); } return route; }
QStringList MythGenericTree::getRouteByString() { QStringList routeByString; routeByString.push_front(getString()); MythGenericTree *parent = this; while( (parent = parent->getParent()) ) { routeByString.push_front(parent->getString()); } return routeByString; }
QList<int> MythGenericTree::getRouteById() { QList<int> routeByID; routeByID.push_front(getInt()); MythGenericTree *parent = this; while( (parent = parent->getParent()) ) { routeByID.push_front(parent->getInt()); } return routeByID; }