Hello
I have a MainWindow with slots and signals and QThread. I have no problem connecting signals from my thread (Control_C) with slots from my mainWindow.
connect(this, SIGNAL(connected()), myMainWindow_p, SLOT(establishedConnection()));
connect(this, SIGNAL(disconnected()), myMainWindow_p, SLOT(closedConnection()));
connect(this, SIGNAL(connected()), myMainWindow_p, SLOT(establishedConnection()));
connect(this, SIGNAL(disconnected()), myMainWindow_p, SLOT(closedConnection()));
To copy to clipboard, switch view to plain text mode
But the other way around won't work:
connect(actionVia_CAN_Bus, SIGNAL(triggered()), myControl_p, SLOT(establishConnectionCan()));
connect(actionVia_RS_232, SIGNAL(triggered()), myControl_p, SLOT(establishConnectionRs232()));
connect(actionDisconnect, SIGNAL(triggered()), myControl_p, SLOT(closeConnection()));
connect(actionVia_CAN_Bus, SIGNAL(triggered()), myControl_p, SLOT(establishConnectionCan()));
connect(actionVia_RS_232, SIGNAL(triggered()), myControl_p, SLOT(establishConnectionRs232()));
connect(actionDisconnect, SIGNAL(triggered()), myControl_p, SLOT(closeConnection()));
To copy to clipboard, switch view to plain text mode
I get:error C2664: 'bool QObject::connect(const QObject *,const char *,const QObject *,const char *,Qt::ConnectionType)'
Converting from object to Control_C impossible. That makes sense, obviously. But is there a workaround?
Thanks in advance.
edit: solved i had to use a cast operator (QObject *)myControl_p
Bookmarks