Example #1
0
/**
 * Removes the TreeItem with the given Index including all its children
 */
void StationTreeModel::removeStationList(QModelIndex index)
{
	if (index.isValid()) //
	{
		ModelTreeItem* item = static_cast<ModelTreeItem*>(getItem(index));

		// also delete the lists entry in the list directory of the model
		for (size_t i = 0; i < _lists.size(); i++)
			if (item == _lists[i])
				_lists.erase(_lists.begin() + i);

		removeRows(0, item->childCount(), index);
		removeRows(item->row(), 1, parent(index));
	}
}