As written in my comment, you can use the following method:
QStringList QFileDialog::selectedFiles() const
Returns a list of strings containing the absolute paths of the selected files in the dialog. If no files are selected, or the mode is not ExistingFiles or ExistingFile, selectedFiles() contains the current path in the viewport.
Also, note that your code will need some refactoring to actually pass either the QFileDialog over or the path string itself. Currently, there is no direct access to them.
If you chooes to pass the QFileDialog somehow, you can get the string list, and it will only contain one item in your case, so you could use the first()
convenience method then.