Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Connect 2 singletons?
Qt 6.11 is out! See what's new in the release blog

Connect 2 singletons?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 584 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gibbz
    wrote on last edited by Gibbz
    #1

    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);
    
    G 1 Reply Last reply
    0
    • G Gibbz

      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);
      
      G Offline
      G Offline
      Gibbz
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved