Unsolved Eventloop and exec()
-
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);
and
QThread *thread=new QThread();QTcpSocket * socket=new QTcpSocket(this);
and
QTcpSocket * socket=new QTcpSocket();how this makes difference?
-
Hi,
The
this
parameter that you give makes the object created a child of whatever QObject based classthis
is.Did you already read the Threads and QObjects chapter of Qt's documentation ?
-
@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?
-
@MokJ said in Eventloop and exec():
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.