How can call update()
on QQuickItem
from a worker thread without causing the following warning?
Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()
I want to enforce QQuickItem::updatePaintNode()
to execute.
I tried the solution of hooking a QObject::connect
from the worker thread to a slot which calls MyQQuickItem->update()
. Everything works fine though. QQuickItem::updatePaintNode()
is called after the signal emit & the QQuickItem
is updated the way I want. But I get this warning on every update call I schedule which I understand as you cannot update UI from worker thread. But what is the way to do this without a warning in Qt?
BUT, How can I get rid the warning that I get on every update call?
Note: I had to make the QObject::connect
with a Qt::DirectConnection
since a Qt::QueuedConnection
did not work for calling update through a signal.
Checked through this discussion here. Discussion in this link ends with a complain about the same warning that I am getting here. My question is what should I correct to avoid that warning?