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 @ top
  • functionname either declared in slots section or has q_invokable macro

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -