Well, if you are loading data into a QTreeView you have to be already using the Model-View design pattern.

A way (maybe not the best) to get what I guess you want, is creating a function in your project class where you could pass the Model pointer to QTreeView, to then call this function in the main.cpp (after *.show()).

Something like this: lets say your project class is named "Test" and the function "showData", so:

test.h:
@
class Test : public QMainWindow
{

Q_OBJECT

public:

explicit Test(QWidget *parent = 0);
~Test();
...
void showData();
...

};
@

test.cpp:
@
...

void Test::showData() {

ui->treeView->setModel(&model);

}

...
@

... and then in your main.cpp, call showData() after w.show():

main.cpp:
@
int main(int argc, char *argv[]) {

QApplication a(argc, argv);

Test w;

w.show();

w.showData();

return a.exec();

}
@

Another suggestion is to review the way about how you have implemented the load of your data, focused on performance.

Another option is to separate the model's code that gathers the data into a background process and to notify the model of the data dropping in. This it the way the [[Doc:QFileSystemModel]] works. Make sure to read the excellent article on "Threads, Events and QObjects":/wiki/Threads_Events_QObjects to avoid common problems and pitfalls.