When I insert elements into a QTreeWidget
, I allocate memory for both QStringList
and QTreeWidgetItem
QStringList *temp;
while(other_elements)
{
temp = new QStringList();
temp->push_back("first_field");
temp->push_back("second_field");
items.append(new QTreeWidgetItem((QTreeWidget*)0, *temp));
element_iterator++;
}
myTreeWidget->insertTopLevelItems(0, items);
I read that QTreeWidgetItem
is automatically deallocated when the clear()
function is called, but what about the QStringList
? Is it a memory leak?