本文整理汇总了C++中MythGenericTree::getChildByName方法的典型用法代码示例。如果您正苦于以下问题:C++ MythGenericTree::getChildByName方法的具体用法?C++ MythGenericTree::getChildByName怎么用?C++ MythGenericTree::getChildByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythGenericTree
的用法示例。
在下文中一共展示了MythGenericTree::getChildByName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetNodeByString
/*!
* \brief Using a path based on the node string, set the currently
* selected node
*
* \param route List defining the path using node strings starting at the root node
*
* \return True if successful
*/
bool MythUIButtonTree::SetNodeByString(QStringList route)
{
if (!m_rootNode)
{
DoSetCurrentNode(NULL);
return false;
}
MythGenericTree *foundNode = m_rootNode;
bool foundit = false;
if (!route.isEmpty())
{
if (route[0] == m_rootNode->getString())
{
if (route.size() > 1)
{
for (int i = 1; i < route.size(); i ++)
{
MythGenericTree *node = foundNode->getChildByName(route[i]);
if (node)
{
node->becomeSelectedChild();
foundNode = node;
foundit = true;
}
else
{
node = foundNode->getChildAt(0);
if (node)
{
node->becomeSelectedChild();
foundNode = node;
}
break;
}
}
}
else
foundit = true;
}
}
DoSetCurrentNode(foundNode);
m_currentDepth = qMax(0, (int)(foundNode->currentDepth() - m_depthOffset - m_numLists));
m_activeListID = qMin(foundNode->currentDepth() - m_depthOffset - 1, (int)(m_numLists - 1));
SetTreeState(true);
return foundit;
}
示例2: searchComplete
void GameUI::searchComplete(QString string)
{
if (!m_gameUITree->GetCurrentNode())
return;
MythGenericTree *parent = m_gameUITree->GetCurrentNode()->getParent();
if (!parent)
return;
MythGenericTree *new_node = parent->getChildByName(string);
if (new_node)
m_gameUITree->SetCurrentNode(new_node);
}