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?
QtWS25 Last Chance

How to connect using const char* method?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qobjectsignal & slot
3 Posts 2 Posters 456 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.
  • C Offline
    C Offline
    CJha
    wrote on 12 Jul 2021, 19:47 last edited by
    #1
    This post is deleted!
    J 1 Reply Last reply 12 Jul 2021, 19:57
    0
    • C CJha
      12 Jul 2021, 19:47

      This post is deleted!

      J Offline
      J Offline
      JonB
      wrote on 12 Jul 2021, 19:57 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.

      C 1 Reply Last reply 12 Jul 2021, 20:14
      1
      • J JonB
        12 Jul 2021, 19:57

        @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.

        C Offline
        C Offline
        CJha
        wrote on 12 Jul 2021, 20:14 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

        3/3

        12 Jul 2021, 20:14

        • Login

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