Yes, I corrected the mistakes in the way you suggested. But I still get the same compiler error I mentioned above in my first post:
release\MainWindow.o(.text+0x28f):MainWindow.cpp: undefined reference to 'Dialog::Dialog(QWidget*)'
The problem must be somewhere else and I suspect that I am not aware of a property of QMainWindow that prevents me to create an instance of a Dialog inside its member functions. Remember: the same code works in member functions of classes that inherit other QObjects.
I reduced the MainWindow class even further and still get the same error:
public:
MainWindow
(QWidget *parent
=0,Qt
::WFlags flags
=0);
void createDialog();
private:
Ui::MainWindow *ui;
};
MainWindow
::MainWindow(QWidget *parent,Qt
::WFlags flags
){ ui = new Ui::MainWindow;
ui->setupUi(this);
createDialog();
}
void MainWindow::createDialog(){
Dialog d;
}
class MainWindow : public QMainWindow {
public:
MainWindow(QWidget *parent=0,Qt::WFlags flags=0);
void createDialog();
private:
Ui::MainWindow *ui;
};
MainWindow::MainWindow(QWidget *parent,Qt::WFlags flags){
ui = new Ui::MainWindow;
ui->setupUi(this);
createDialog();
}
void MainWindow::createDialog(){
Dialog d;
}
To copy to clipboard, switch view to plain text mode
Bookmarks