Signal-slot connection, made in plugin, loaded from another thread doesnt works

  • Hi

    found an issue, may be it known one

    I'm loading an plugins and create connections within the plugins instances. If the plugins loaded from main thread, all connections works, however, if I'm loading plugins from another thread, connections doesnt works

    how to fix this?
    I want my plugins to be loaded from another threads, because there is lot of them and app startup will takes forever if I'll do this in main thread


  • Moderators

    do you use the queued connection type?!

  • yes, I've added Qt::QueuedConnection but this didnot helped

  • Lifetime Qt Champion


    what kind of thread are you using to load the plugins and how do you load them ?

    Do you mean the connections within the plugin doesn't work or between your application and the plugins ?

  • Hi
    thread is a class, subclassed from QThread
    Loading plugins in method run() using QPluginLoader

    the connection within loaded plugin doesnt works

  • Lifetime Qt Champion

    Can you create a minimal compilable sample application that reproduce the problem ?

  • well, the minimal sample will be half of my project

  • Moderators

    so either way your project isn't very big yet, or the example isn't "minimal".
    This should be minimal in terms of 30-40 lines of code IMHO.

  • one approach to debug this could be to add a qDebug or console output for every connect statement in your plugins printing out the return value of the connect statement (true/false) and some sort of identification of the affected connect statement. this way you can at least find out which connect statements fail.

    Maybe the objects being unsuccessfully connected can give a hint to the cause of the problem.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.