Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Eventloop and exec()
MokJ last edited by
Whats an eventloop , and how exec() works?
I have read the documentation of qt but I'm really looking for a bit clearer explanation.
whats the difference between
QThread *thread=new QThread(this);
QThread *thread=new QThread();
QTcpSocket * socket=new QTcpSocket(this);
QTcpSocket * socket=new QTcpSocket();
how this makes difference?
thisparameter that you give makes the object created a child of whatever QObject based class
Did you already read the Threads and QObjects chapter of Qt's documentation ?
MokJ last edited by MokJ
@SGaist thanks , and yes I have.
But whats confusing me is , when I'm creating an object of QTcpSocket and and I'm using the instance of a worker object instead of this does that mean that the particular QTcpSocket is the child of the worker object ?
worker *work=new worker(); QTcpScoket socket=new QTcpSocket(work); work->moveToThread(thread);
and whats QEventLoop?
JonB last edited by JonB
QTcpScoket socket=new QTcpSocket(work);
would indeed make the socket owned by the worker.
QEventLoop, as the name suggest, represent a loop that is processing events. Events can be, for example, mouse events, windows showing and hiding, etc.