示例#1
0
void UIListTreeType::FillLevelFromTree(UIListGenericTree *item,
                                       UIListBtnType *list)
{
    if (!item || !list)
        return;

    ClearLevel(list);

    QPtrList<GenericTree> *itemlist = item->getAllChildren();

    QPtrListIterator<GenericTree> it(*itemlist);
    GenericTree *child;

    while ((child = it.current()) != 0)
    {
        UIListGenericTree *uichild = (UIListGenericTree *)child;

        UIListBtnTypeItem *newitem;

        int check = uichild->getCheck();
        newitem = new UIListBtnTypeItem(list, child->getString(),
                                        uichild->getImage(), (check >= 0),
                                        (UIListBtnTypeItem::CheckState)check,
                                        (child->childCount() > 0));
        newitem->setData(uichild);

        uichild->setItem(newitem);

        if (!uichild->getActive())
            newitem->setOverrideInactive(true);

        ++it;
    }
}
示例#2
0
QStringList UIListTreeType::getRouteToCurrent()
{
    //
    //  Tell whatever is asking a set of strings (node string/title values)
    //  that make a route to the current node
    //

    QStringList route_to_current;
    if (currentpos)
    {
        GenericTree *climber = currentpos;
        route_to_current.push_front(climber->getString());
        while( (climber = climber->getParent()) )
        {
            route_to_current.push_front(climber->getString());
        }
    }
    return route_to_current;
}