No, the receiver of the signal should a be a slot that creates and shows the dialog: you had one called actionTest() in your main window class. The dialog object doesn't exist until you create it.
Your connect() calls are broken and should be generating a compiler error or runtime warning. The arguments to the connect() are:
- A pointer to the sender QObject
- the SIGNAL() being sent
- A pointer to the receiving object
- the SLOT() receiving the signals when sent
So, with the slot in your main window class renamed doStuff() to highlight the distinction from the actionTest QAction:
connect(ui->actionTest, SIGNAL(triggered()), this, SLOT(doStuff()));
connect(ui->actionTest, SIGNAL(triggered()), this, SLOT(doStuff()));
To copy to clipboard, switch view to plain text mode
is closer to the mark.
Bookmarks