Qt-interest Archive, June 2007
First application running, but I can't figure out this error.
Message 1 in thread
Okay, so in main.cpp, I create an instance of Class A, derived from
QObject.
Within Class A, I add members Thread1*, Thread2*, Thread3*.... All
derived from QThread, which I create instances of those via a "new" as
well..
Then I do a Thread1->start(), Thread2->start(), etc...
So everything runs, all the demo signals and slots I setup appear to
work. However, this appears at the beginning of every run:
QObject: Cannot create children for a parent that is in a different
thread.
(Parent is Thread2(003DDE40), parent's thread is QThread(003D6C20),
current thread is Thread2(003DDE40)
I only get this for Thread2 and Thread3, NOT Thread1. The differences
are:
Thread 2 & 3 run "exec()" and hence have event loops, Thread 1 is just a
standard "while(!quit)" thing.
Thread 2 & 3 have connect() statements to transmit back up to the A
instance, whereas Thread 1 has no connect() statements.
Here's a glance at my ctor:
Thread1::Thread1(QObject *parent, int pollValue): /*QThread(parent),*/
m_PollValue(pollValue)
{
}
I commented out the parent being passed to the base class (QThread)
since the error seemed to indicate that there shouldn't be a parent for
a thread. The error still occurs though (I guess it's a warning, since
everything appears to run)
Opinions? What is the DUMB thing I'm doing here?
THANKS!
Rich Brown