according to you code fileName is an empty string, line 9.
QFileDialog::selectFile takes a const reference, so it should not modify fileName.