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. Why i am getting below error when connect catch signal of other class in my desire class?

Why i am getting below error when connect catch signal of other class in my desire class?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 298 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    statuscontroller.cpp:15:39: error: call to non-static member function without an object argument

    QObject::connect(ptr,&MainWindow::sigPollRequest(),this,&StatusController::slotPollingRequested);
    
    Christian EhrlicherC 1 Reply Last reply
    0
    • Q Qt embedded developer

      @Christian-Ehrlicher can you give example how to pass it ?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #5

      @Qt-embedded-developer

      spot the difference:

      &MainWindow::sigPollRequest()

      &StatusController::slotPollingRequested


      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
      2
      • Q Qt embedded developer

        statuscontroller.cpp:15:39: error: call to non-static member function without an object argument

        QObject::connect(ptr,&MainWindow::sigPollRequest(),this,&StatusController::slotPollingRequested);
        
        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Qt-embedded-developer said in Why i am getting below error when connect catch signal of other class in my desire class?:

        &MainWindow::sigPollRequest()

        Because you call a function here but you have to pass a function pointer.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        Q 1 Reply Last reply
        2
        • Christian EhrlicherC Christian Ehrlicher

          @Qt-embedded-developer said in Why i am getting below error when connect catch signal of other class in my desire class?:

          &MainWindow::sigPollRequest()

          Because you call a function here but you have to pass a function pointer.

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by
          #3

          @Christian-Ehrlicher can you give example how to pass it ?

          jsulmJ J.HilkJ 2 Replies Last reply
          0
          • Q Qt embedded developer

            @Christian-Ehrlicher can you give example how to pass it ?

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

            @Qt-embedded-developer What example?!
            You're already passing a function pointer for the slot, simply do it also for the signal. Just look at your code and think about what is wrong...

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

            1 Reply Last reply
            1
            • Q Qt embedded developer

              @Christian-Ehrlicher can you give example how to pass it ?

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #5

              @Qt-embedded-developer

              spot the difference:

              &MainWindow::sigPollRequest()

              &StatusController::slotPollingRequested


              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
              2

              • Login

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