I have a pointer that is passed to a series of functions, where one function returns an address and assigns that address to the pointer. After seeking some help on Stackoverflow, the collect_file_path
method has a parameter of type QStringList**
. Although I understand what is going on I have not come across this notation in any of the text books I own, plus, it looks ugly.
I would like some advice/feedback on how other programmers would implement what I have done in the code below. Would you use QStringList**
, or some other method?
I hope what I'm asking makes sense. My current code is:
void ThreadWorker::run()
{
QStringList* file_list;
collect_file_paths(&file_list);
}
void ThreadWorker::collect_file_paths(QStringList** file_list)
{
DirectorySearch ds;
*file_list = ds.get_file_names(_strPath);
}
QStringList* DirectorySearch::get_file_names(QString path)
{
QStringList *file_names = new QStringList;
traverse(path, file_names);
return file_names;
}
Thanks