Solved How to call derived class' function from connected slot
-
For example in TCP or WebSocket server when there is a connection we connect a signal to a slot like this:
void Server::processMessage(QByteArray message) { QWebSocket *pClient = qobject_cast<QWebSocket *>(sender()); if(pClient) { doSomething(); } }
I tried to make doSomething() virtual but it doesnt call the overridden doSomething() function in derived class. Is there anything I can do or I have to connect one more time from derived class?
-
Hi,
Can you show your complete code ?
-
It works as expected. I did a mistake in client program so therefore I couldn't see if it is called or not.
It is solved now.
After making 1 hour research about how signal-slot system works and what C++ compiler does, I decided to write here but found my mistake :)