Answer the question
In order to leave comments, you need to log in
QTcpSocket in different classes?
Hello, I'm new. I want to connect via qtcpsoket to the server. The problem is that I'm connecting, but I need to use this connection in other classes.
My task is to connect, wait for data to be sent from the mainwindow (login and password), after sending, receive a response (0 or 1), enter the confirmation code in another window (if the response was 1).
Tell me please. I’ve been stuck on this for two weeks, I can’t figure it out. There is no information on the Internet. It is advisable to explain with an approximate code)
Answer the question
In order to leave comments, you need to log in
Communication over the network should be handled by one class. You can pass data to other classes using the signal/slot mechanism.
Those. in a class that deals with network communication, you create a signal, and in another you associate it with a slot. At the right time, pull the signal with the right data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question