Problem with using functions of others class.
-
Hi :).
I start a little project that have to goal to create a little online chat.
I met a problem:
I have a MainWindow class and a TcpServer class.
I included TcpServer in MainWindow, but I would need to be able to call a function of MainWindow in TcpServer.
I tried some ways to do it (give the MainWindow object as parameter, using pointer on functions) but it wasn't working.
If you want to see the code to understand the problem, please tell me and I'll post it.Thanks in advance :).
-
Hi
Normally you use signals and slots.
Like when TcpServer got a connection it calls a slot in mainwindow.
You set it up with connect.http://doc.qt.io/qt-5/signalsandslots.html
http://www.bogotobogo.com/Qt/Qt5_QTcpServer_Client_Server.php
http://www.bogotobogo.com/Qt/Qt5_QTcpServer_Multithreaded_Client_Server.php