c++ - Qt add function call to event loop from other thread -
i've stumbled across problem can't solve on elegant way right now. situation: have callback function called outside application. callback function has update gui object.. since can't call (for example) repaint()
within thread, have finde way add function call main event loop task gets executed @ time.
one possible way use this:
qmetaobject::invokemethod(object, "functionname", qt::queuedconnection, q_arg(float, value));
however, gives me response no such method "object::functionname"
. (which lie!)
i've read connecting signal slot called event loop setting connection type qt::queuedconnection
. however, using qojbect.:connect()
won't work since don't knwo object signal needs get. nice like
qobject::emit(object, signal(function(flaot)), arg);
qmetaobject::invokemethod
should use in kind of situation. make sure that:
object
qobject subclass q_object macro @ topfunctionname
either declared in slots section or has q_invokable macro
Comments
Post a Comment