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. How to connect using const char* method?
Servers for Qt installer are currently down

How to connect using const char* method?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qobjectsignal & slot
3 Posts 2 Posters 518 Views 1 Watching
  • 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.
  • CJhaC Offline
    CJhaC Offline
    CJha
    wrote on last edited by
    #1
    This post is deleted!
    JonBJ 1 Reply Last reply
    0
    • CJhaC CJha

      This post is deleted!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @CJha said in How to connect using const char* method?:

      Since the receiving object has no idea of the emitting object, I am trying to send my slot from receiving object to emitting object to be connected to its signal.

      You really are not supposed to do anything like this. Signallers should not need to know anything about slotters. The usual paradigm is to have somewhere in your code which knows about both the signaller and the slot(s) and do the connect() there.

      CJhaC 1 Reply Last reply
      1
      • JonBJ JonB

        @CJha said in How to connect using const char* method?:

        Since the receiving object has no idea of the emitting object, I am trying to send my slot from receiving object to emitting object to be connected to its signal.

        You really are not supposed to do anything like this. Signallers should not need to know anything about slotters. The usual paradigm is to have somewhere in your code which knows about both the signaller and the slot(s) and do the connect() there.

        CJhaC Offline
        CJhaC Offline
        CJha
        wrote on last edited by
        #3

        @JonB I understand the usual paradigm, but my code is made in such a way so that the sender object is hidden, and so there is not really any place where header files from both sender and receiver are included simultaneously. This is to maintain modularity in the code.

        However, by using:

        connect(this, SIGNAL(testConnection()), receiver, method);
        

        in the sender it recognizes that I am trying to connect to Receiver::testConnection() and it has the pointer to the receiver passed to it, then in theory it should be capable of connecting its signal to the receiver's slot with only this much information about the receiver.

        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