Hi again,
this is correct I emit the SIGNAL in currentTest->execute( )
But I can't put the exec after this statement, because I need a QTimer in
execute
How can I solve this problem?
Regards,
Patrick
"Hemanth N" <hemanth.n@xxxxxxx> schrieb im Newsbeitrag
news:OFB97A618B.627B9010-ON652572F1.0035F34E-652572F1.00364C58@xxxxxxxxxx
Hi Patrick,
Probably what i can understood from your code is:
You are emitting the signal in currentTest-> execute( )
Please look at the documents once , specifically on exec( ) functionality.
exec( ) will invoke the event handler and execution of that statement
doesnt return immediately unless the main widget is closed or application
is killed.
(In this case may be when the thread is killed)
Hence move the currentTest-> execute( ) onto the top of exec( )
Thanks & Regards,
Hemanth Kumar Nakkina
Tata Consultancy Services
Mailto: hemanth.n@xxxxxxx
Website: http://www.tcs.com
"Patrick Feistel" <Feistel@xxxxxxxxxx>
06/05/2007 03:10 PM Toqt-interest@xxxxxxxxxxxxx
cc
SubjectRe: QThread::exec and Signals
Hello and thanks for posting,
if I change the order of connect and exec it still won't work.
I do the following in the QThread::run():
--
...
currentTest = new TestConfigure();
connect(currentTest, SIGNAL(newData()), this, SLOT(dataAvailable()));
exec();
currentTest->execute();
exit(0);
currentTest->disconnect();
delete currentTest;
currentTest = NULL;
...
--
I don't know how to get the SIGNAL.
Regards,
Patrick
"Tomás Kazmar" <Tomash.Kazmar@xxxxxxxxx> schrieb im Newsbeitrag
news:15430.17645-1211-222591844-1181035584@xxxxxxxxxxxx
Hi Patrick,
as I understand it, when you call QThread::exec() thread enters an event
loop
and a call to connect() is exectuted only after the thread exits the
loop.
If you
change the order of these two it will start working.
Maybe also you want to read the part of the docs concerning
multithreading,
especially:
http://doc.trolltech.com/4.3/threads.html#per-thread-event-loop
and
http://doc.trolltech.com/4.3/threads.html#signals-and-slots-across-threads
Regards,
Tomas
# Hello,
#
# I have an app with 2 threads.
# In QThread::run I first call QThread::exec() and than I connect a
SIGNAL
of
# OBJECT_A to the SLOT of my class derived from QThread. After that I
call
a
# function of OBJECT_A which emits the SIGNAL.
# My problem is that the SIGNAL is not received by the class derived from
# QThread.
#
# Can you tell me how to do such things with an event-loop.
#
# Regards,
# Patrick
#
# P.S.: I need a seperate event-loop to use QTimer in my second thread...
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
ForwardSourceID:NT000114D6
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you