Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QFileDialog from within a class
gibbogle last edited by
Probably a stupid question, since I am at a primitive level of understanding...
I have created a class like this:
and instantiate it in MainWindow. I want to call QFileDialog() within one of the QVideoOutput member functions,
but I have not been able to figure out what the first argument (QWidget *parent) should be. Various choices of awidget
corresponding to GUI widgets fail, causing the program to crash. Obviously there is something fundamentally wrong with
what I'm doing. I'd appreciate helpful advice.
You need to pass the pointer of your QMainWindow to it (or from any other widget). If you don't have it at hand, you can simply pass 0 (zero).
You can also make your QMainWindow into a Singleton (this is a programming construct, search the Web for more info) and then use it in your class. There are many options :)