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 check whether the connect in QT is successful or not
Forum Updated to NodeBB v4.3 + New Features

how to check whether the connect in QT is successful or not

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 5.7k 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    Hi I have

    situation in which I connect a signal slot and pass some pointers in SLOT

    now I question is that some time pointer allocation is done later but connect in done earlier so how do in code we can that connect fro signal and slot is successful

    RatzzR 1 Reply Last reply
    0
    • Q Qt Enthusiast

      Hi I have

      situation in which I connect a signal slot and pass some pointers in SLOT

      now I question is that some time pointer allocation is done later but connect in done earlier so how do in code we can that connect fro signal and slot is successful

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by
      #2

      @Qt-Enthusiast said in how to check whether the connect in QT is successful or not:

      how do in code we can that connect fro signal and slot is successful

      Use qDebug() which returns true if connect is successful.

      --Alles ist gut.

      jsulmJ 1 Reply Last reply
      0
      • RatzzR Ratzz

        @Qt-Enthusiast said in how to check whether the connect in QT is successful or not:

        how do in code we can that connect fro signal and slot is successful

        Use qDebug() which returns true if connect is successful.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Ratzz You mean

        qDebug() << connect(...);
        

        :-)

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        RatzzR 1 Reply Last reply
        3
        • jsulmJ jsulm

          @Ratzz You mean

          qDebug() << connect(...);
          

          :-)

          RatzzR Offline
          RatzzR Offline
          Ratzz
          wrote on last edited by
          #4

          @jsulm
          Yes MOD :)
          I was about to edit to

          qdebug() << connect(sender, SIGNAL(hisSignal()), this, SLOT(hisSlot()));

          --Alles ist gut.

          1 Reply Last reply
          3
          • J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by SGaist
            #5

            Technically it's return QMetaObject::Connection which has qDebug operator that returns true or false. But that's mostly nitpicking.

            I would suggest using the new Qt5 Signal/Slot syntax, it checkes connections at compile time, meaning, if the connect can't work the compiler stops and you don't have a working program.

            Simple.

            [edit: fixed Qt typo SGaist]


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            6

            • Login

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