Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Connecting signal to an arbitrary function in Qt
Qt 6.11 is out! See what's new in the release blog

Connecting signal to an arbitrary function in Qt

Scheduled Pinned Locked Moved 3rd Party Software
9 Posts 2 Posters 3.3k 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.
  • S Offline
    S Offline
    sarahjohn
    wrote on last edited by
    #1

    hi,
    am i able to connect a signal to a function which is in some other namespace and also not inside a particular class.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      With Qt 4: no
      With Qt 5: it depends, take a look at "this":http://qt-project.org/wiki/New_Signal_Slot_Syntax

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sarahjohn
        wrote on last edited by
        #3

        thank u for the reply.i have 1 more doubt can i simply call a function in some other namespace in qt 4.8 , when i tried i got errors with the emit function in a header file??

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Signals and slots must be members of a QObject

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sarahjohn
            wrote on last edited by
            #5

            I am not trying to connect function to a slot.I am just trying to call a function in Qt4.8 which in some other namespace. Do i need to mention something in .pro file for that ?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Can you show your code ? And the error you are getting ? It will be easier to help you then.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Have a look at "this":http://qt-project.org/doc/qt-4.8/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots .

                The library uses at least one same keyword as Qt, so this is how to make them play together

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sarahjohn
                  wrote on last edited by
                  #8

                  Thank u for the answer.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    You're welcome !

                    If this solves your problem don't forget to update the thread's title prepending [solved] to it :)

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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