I experienced this with a derived class, but it's the same with QDialog base class:
when I do
QDialog dialog();
dialog.exec();
the compiler complains
J:\...\mainwindow.cpp:-1: In member function 'void MainWindow::on_viewButton_pressed()':
J:\...\mainwindow.cpp:72: Fehler:request for member 'exec' in 'dialog', which is of non-class type 'QDialog()'
This has something to do with the constructor being used, because when i do
QDialog dialog(0);
dialog.exec();
the code compiles without errors. This is also working:
QDialog *dial = new QDialog();
dial->exec();
So. Is it because of an explicit constructor?
Documentation says it's defined as
QDialog::QDialog ( QWidget * parent = 0, Qt::WindowFlags f = 0 )
So shouldn't the first two examples do exactly the same? And why is the compiler complaining on the second line, not the one with the constructor.
Thanks for enlightenment, hints to further readings on the topic very welcome