[Qt-interest] QThread event loop running in main thread?
Hannu Shemeikka
hps at shemeikka.org
Mon Dec 27 17:00:44 CET 2010
Well,
Maybe you guys, Nokia or whoever is responsible, should update the
documents. Especially the QThread-stuff. It's written there that "to
create your own threads, subclass QThread and reimplement run()."
Someone should write a nice good tutorial on QThread and its proper
usage. It would save a lot of time from everyone. And I don't mean a
simple producer-worker example.
Little off-topic but hopefully nobody cares about it :)
I used to do things almost like the original poster is doing and things
worked. Though I don't know why his doesn't work.
On 27.12.2010 16:05, Thiago Macieira wrote:
> On Monday, 27 de December de 2010 04:05:02 lbutler3 at comcast.net wrote:
>> I seem to be having trouble with a QThread and signals/slots.
> When I read the first sentence, I thought "he's using slots in a class derived
> from QThread". So reading a bit below, we see:
>
>> In my main window constructor I do:
>>
>> connect(this, SIGNAL(tweakThread()),&myThread, SLOT(tweak()),
>> Qt::QueuedConnection);
> Simply don't do that. DO NOT put slots in a class derived from QThread and
> you'll save yourself a lot of headaches. You can add signals, but you
> shouldn't.
>
> Instead, create a new QObject with the signals and slots and make sure it's
> moved to or created in the other thread.
>
> Think of QThread as "the resource managing a thread", not the work to be done.
> So "tweak" means tweaking the thread, whatever that should mean (as in "kill
> the thread", "start the thread", "set the thread's priority").
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101227/4b1a4155/attachment.html
More information about the Qt-interest-old
mailing list