Important: Please read the Qt Code of Conduct -


  • Hello forum,

    I am pulling out the invisible root item from an qtreewidget with the following command:

    QTreeWidgetItem *rootItem = treewidget->invisibleRootItem();

    Then i initilialize another tree widget item where we have the rootitem as the parent

    QTreeWidgetItem *new_widget_item = new QTreeWidgetItem(rootItem);

    Now i want to insert the new_widget_item into the qtreewidget object and i do not find any relevant function to it.

    Any hint?


  • You create a toplevel item. Insert this with "QTreeWidget::addTopLevelItem() ":/doc/qt-4.8/qtreewidget.html#addTopLevelItem or "QTreeWidget::insertTopLevelItem() ":/doc/qt-4.8/qtreewidget.html#insertTopLevelItem.

Log in to reply