QFileDialog from within a class
-
Probably a stupid question, since I am at a primitive level of understanding...
I have created a class like this:classQVideoOutput:publicQObject
{public:
QVideoOutput(QObjectparent=0,vtkRenderWindowVTKrenWin=0,QWidget*awidget=0);
...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.Thanks
Gib -
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 :)