Hi Everybody,
Can someone tell me what is wrong with the code below.All I want to do is connecting an action to a slot which is defined in a derived class.
I get the following error message saying QMainWindow doesnt have such a slot but code uses a derived class(SMainWindow) which has the rewuired slot.
Object::connect: No such slot QMainWindow::slotNewGraph() in c:\qt_test\main.cpp:26
Object::connect: (sender name: 'actionNew')
Object::connect: (receiver name: 'MainWindow')
#include "QApplication.h"
#include "mainactions.h"
class SMainWindow : public QMainWindow
{
private slots:
void slotNewGraph()
{
printf("new Graph\n");
}
};
int main(int argc, char** argv)
{
QApplication app(argc,argv);
Ui::MainWindow ui;
SMainWindow* mainForm=new SMainWindow;
ui.setupUi(mainForm);
QAction* actionNew = mainForm->findChild<QAction*>("actionNew");
QObject::connect(actionNew, SIGNAL(activated()), mainForm, SLOT(slotNewGraph()));
mainForm->show();
return app.exec();
return 0;
}
Thanks in advance!

