You're right, but the original Jason's message contains this fragment:
> Inside of BackgroundClass in the constructor, I start a QTimer that is
> supposed to go off every 5minutes and call the runTasks function when it does.
> QTimer* timer = new QTimer(this);
So the timer is created on the heap
>From what I understand, moveToThread() requires a parent-child relationship
between the objects for the "subtree" to include them.
If the QTimer was a subobject (data member) rather than a pointer to
another heap object with the parent set, then the QTimer won't be moved to
the other thread along
The description of QObject::moveToThread() says the whole object's
"subtree" is moved, so that hypothesis doesn't sound very plausible.
On Oct 9, 2014 3:06 PM, "Jason Kretzer" wrote:
> Ack! You are correct.
>
> I guess I would do something like this to remedy that:
>
> in the main:
> BackgroundT
Ack! You are correct.
I guess I would do something like this to remedy that:
in the main:
BackgroundTaskManager::init();
QThread *thread = new QThread();
connect(thread, SIGNAL(started()), BackgroundTaskManager::instance(),
SLOT(startTimer()));
BackgroundTaskManager::instance()->m
On Thursday 09 October 2014 03:32:20 Jason Kretzer wrote:
> Thanks for the response.
>
> Yeah, I have placed qDebug() just before and just after the emit. The one
> before always prints, the one after never does except in the following
> case. If I change the connection to QueuedConnection, the
Thanks for the response.
Yeah, I have placed qDebug() just before and just after the emit. The one
before always prints, the one after never does except in the following case.
If I change the connection to QueuedConnection, then the qDebug right after
does print, the rest of the function does
soft.com...@qt-project.org] On Behalf
> Of Jason Kretzer
> Sent: Thursday, 9 October 2014 2:43 PM
> To: interest@qt-project.org
> Subject: [Interest] Threading Question
>
> I am a bit confused on threading.
>
> Lets say I have Thread A - which is where the program is started - has
Two suggestions:
1) add qDebug-s around the "emit someSignal();" line to see whether it
returns or not, hanging somewhere in validateResult();
2) try to explicitly specify the Qt::QueuedConnection type for the
someSignal() connection — if it helps, then the [most likely] cause is
Qt choosing wrong
Addendum at the bottom…
On Oct 8, 2014, at 11:42 PM, Jason Kretzer wrote:
> I am a bit confused on threading.
>
> Lets say I have Thread A — which is where the program is started — has
> main(), etc.
>
> Inside of main() I instantiate a class called BackgroundClass and I move it
> to another
I am a bit confused on threading.
Lets say I have Thread A — which is where the program is started — has main(),
etc.
Inside of main() I instantiate a class called BackgroundClass and I move it to
another thread (Thread B).
BackgroundClass::init();
QThread *thread = new QThread(
10 matches
Mail list logo