This is not really a Qt question: it's a standard C++ question with standard C++ answers.
- Provide your dialog class with a public getter function that gets the file name so the main window code can pull the value out of the dialog (like QFileDialog::selectedFiles()).
- Provide your dialog class with a single function that displays the dialog and returns the selected file name (like QFileDialog::getOpenFileName() and friends).
- Provide your main window class with a public setter function so that the dialog can push the file name back to the main window (through a pointer or reference to the main window).
For a Qt flavoured response you could emit a signal when a file is selected and connect that to a slot in the main window object. This is just a special case of the third option.
Which you choose depends on the exact requirements of the your program.
Bookmarks