QTreeWidgetItem* topLevelItem = new QTreeWidgetItem(); QTreeWidgetItem* childItem1 = new QTreeWidgetItem(topLevelItem); QTreeWidgetItem* childItem2 = new QTreeWidgetItem(topLevelItem); int count = topLevelItem->childCount(); // returns 2In this example, a new top level item is created, along with two child items. The childCount function is called on the top level item, which returns the value 2, as there are two child items. The package library for QTreeWidgetItem is Qt.