Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QTreeWidget::insertTopLevelItem ( int  index,
QTreeWidgetItem item 
)

Inserts the item at index in the top level in the view.

See also:
addTopLevelItem()

Definition at line 1879 of file qtreewidget.cpp.

References QList< T >::at(), QTreeWidgetItem::children, QList< T >::count(), QVector< T >::isEmpty(), QTreeWidgetItem::model, QTreeWidgetItem::par, QStack< T >::pop(), QStack< T >::push(), and QTreeWidgetItem::view.

Referenced by addTopLevelItem().

{
    Q_D(QTreeWidget);
    if (index < 0 || index > d->model()->tree.count() || item == 0)
        return;
    Q_ASSERT(!item->view || !item->model || !item->par);
    QStack<QTreeWidgetItem*> stack;
    stack.push(item);
    while (!stack.isEmpty()) {
        QTreeWidgetItem *i = stack.pop();
        i->view = this;
        i->model = d->model();
        for (int c = 0; c < i->children.count(); ++c)
            stack.push(i->children.at(c));
    }
    d->model()->insertInTopLevel(index, item);
}


Generated by  Doxygen 1.6.0   Back to index