Important: Please read the Qt Code of Conduct -

Connect 2 singletons?

  • I'm trying to add a connection between 2 singletons in my c++. It compiles fine, however the connection doesn't trigger when I emit the appropriate signal.

    I have a library singleton, and a player singleton. Any clues on why this doesn't work?

    The following in player constructor:

        // connect library
        connect(Library::instance(), &Library::activeItemChanged, this, &Player::libraryItemChanged);

  • I have it working!
    I was not creating the player singleton till later in my code, so creating that earlier has fixed the issue :)

Log in to reply