I don't see any need for an invisible widget, since the file dialog doesn't require a a parent widget in order to be shown up.
Since the dialog needs to have a Qt event loop running, you will need to either show the dialog modally using exec()
, or using one of the static functions like getOpenFileName
.
To use any of the widget classes, including the file dialog, you need to have an instance of QApplication
, although that instance doesn't have to have its exec()
method called.