Hi forum,
I have more issues over qtreewidget. In one of the functions in my project i am pulling out the invisible root item with the following function
QTreeWidgetItem *rootItem = treewidget->invisibleRootItem()
To copy to clipboard, switch view to plain text mode
Then i send this item to other function to add widget item recursively in several functions. Apparantly, it may seem a complicated way to populate a tree, but i need to do as i am doing some other processing in those functions.
Now i created a new tree widget item with the parent item(root item in the first pass) as the parent as follows :
//create a new tree item with the tree_item as the parent
//set the text for the new tree widget item
new_widget_item
->setText
(0,
QString(tree_string.
c_str()));
//create a new tree item with the tree_item as the parent
QTreeWidgetItem *new_widget_item = new QTreeWidgetItem(tree_item);
//set the text for the new tree widget item
new_widget_item->setText(0,QString(tree_string.c_str()));
To copy to clipboard, switch view to plain text mode
I want to add the new item into the qtreewidgt and i am not sure which function to use. qtreewidget has several item like; insertTopLevelItem(...), but in that case you have to know the index value.
The issue showed up while porting an wxwidget application and they are adding the item as follows:
wxTreeItemId new_id = TreeViewTree->AppendItem( tree_id, wxString( tree_string.c_str(), wxConvUTF8 ) );
wxTreeItemId new_id = TreeViewTree->AppendItem( tree_id, wxString( tree_string.c_str(), wxConvUTF8 ) );
To copy to clipboard, switch view to plain text mode
On the above snippet the treeviewtree is equivalent to the qtreewidget and tree_id is equivalent to the new_widget_item in Qt.
I am looking for some equivalent function in Qt.
Need some hint here.
Regards
Sajjad
Bookmarks