[solved]Cannot call slot=*(
class LogWindow : public QMainWindow
.... //another code
class LogBrain : public LogWindow
int main(int argc, char *argv)
QApplication logApp(argc, argv);
LogWindow *mainWnd = new LogWindow;
LogBrain *logMind = new LogBrain;
QObject::connect(mainWnd->ui.pushButton, SIGNAL(clicked()), mainWnd, SLOT(replyClicked())); QObject::connect(mainWnd, SIGNAL(msgSent()), logMind, SLOT(textProcessing())); mainWnd->show(); return logApp.exec();
Can't call textProcessing() slot.
I put a breakpoint where signal msgSent() must be emitted and until this moment everything works fine. But then this signal doesn't call slot textProcessing(). I cannot understand what's the problem. I created new project and wrote similar code and there everything is ok and textProcessing() calls without any problems.
I am wondering if LogBrian also need a Q_OBJECT in top of class def?
It works!) It seemed to me, that I tried to add Q_OBJECT but there was an error, something with moc file, but now everything is good, strange. Thanks
Well, when I add Q_OBJECT to a class. I often go an delete whole build folder as its sometimes a bit
hard to make it run moc fully or something like that. Sometimes a "Clean" also works.
The thing to do when you add/remove the Q_OBJECT macro is to re-run qmake (in the Build menu of Qt Creator). That will it turn trigger moc to run again and see that your class needs to be mocked
Yeah, I have already realized that, but thanks)