bool StructureParser::startElement( const QString& namespaceURI,
                                    const QString& ,
                                    const QString& qName,
                                    const QXmlAttributes& attributes)
{
    QTreeWidgetItem * element;


    if (!stack.isEmpty())
    {
        QTreeWidgetItem *lastChild = stack.top().firstChild();

        if ( lastChild )
        {
            while ( lastChild->nextSibling() )
                lastChild = lastChild->nextSibling();
        }
        element = new QTreeWidgetItem( stack.top(), lastChild, qName, namespaceURI );
    }
    else
    {
        element = new QTreeWidgetItem( table, qName, namespaceURI );
    }

    stack.push( element );
    element->setOpen( TRUE );
    if ( attributes.length() > 0 ) {
        for ( int i = 0 ; i < attributes.length(); i++ ) {
            new QTreeWidgetItem( element, attributes.qName(i), attributes.uri(i) );
        }
    }
    return TRUE;
}
Example #2
0
void ObjectItem::Collapse()
{
	QTreeWidgetItem *next;
	QTreeWidgetItem *cur = firstChild();
	while (cur != 0)
	{
		next = cur->nextSibling();
		delete cur;
		cur = next;
	}

	//setPixmap(0, *pm_closed);
}