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 solve Object::connect: No such signal
Qt 6.11 is out! See what's new in the release blog

How to solve Object::connect: No such signal

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 29.5k 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.
  • sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by
    #2

    You are mixing old and new connect syntax.

    Either use this:

    // Old syntax
    connect(this, SIGNAL(MainWindow::newImage(const QImage)), this, SLOT(MainWindow::setImage(const QImage)));
    

    Or this:

    // New syntax:
    connect(this, &MainWindow::newImage, this, &MainWindow::setImage);
    

    I recommend using new syntax whenever possible.

    (Z(:^

    J 1 Reply Last reply
    5
    • mranger90M Offline
      mranger90M Offline
      mranger90
      wrote on last edited by
      #3
      This post is deleted!
      1 Reply Last reply
      0
      • sierdzioS sierdzio

        You are mixing old and new connect syntax.

        Either use this:

        // Old syntax
        connect(this, SIGNAL(MainWindow::newImage(const QImage)), this, SLOT(MainWindow::setImage(const QImage)));
        

        Or this:

        // New syntax:
        connect(this, &MainWindow::newImage, this, &MainWindow::setImage);
        

        I recommend using new syntax whenever possible.

        J Offline
        J Offline
        jaouad100
        wrote on last edited by
        #4

        @sierdzio I was using the new version but I get the error of matching error: no matching function for call to ‘qdude::MainWindow::connect(qdude::MainWindow*, void (qdude::MainWindow::*)(const QImage&), qdude::MainWindow*, void (qdude::MainWindow::*)(const QImage&))’

        JonBJ 1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #5

          @jaouad100 said in How to solve Object::connect: No such signal:

          void setImage(const QImage &);

          Make this method as slot:

          protected slots:
            void setImage(const QImage &);
          

          (Z(:^

          J 1 Reply Last reply
          0
          • sierdzioS sierdzio

            @jaouad100 said in How to solve Object::connect: No such signal:

            void setImage(const QImage &);

            Make this method as slot:

            protected slots:
              void setImage(const QImage &);
            
            J Offline
            J Offline
            jaouad100
            wrote on last edited by
            #6

            @sierdzio The same issue :/

            1 Reply Last reply
            0
            • J jaouad100

              @sierdzio I was using the new version but I get the error of matching error: no matching function for call to ‘qdude::MainWindow::connect(qdude::MainWindow*, void (qdude::MainWindow::*)(const QImage&), qdude::MainWindow*, void (qdude::MainWindow::*)(const QImage&))’

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #7

              @jaouad100 said in How to solve Object::connect: No such signal:

              @sierdzio I was using the new version

              If you say you are using the "new version" syntax, we would not expect to see SIGNAL() or SLOT().

              Would you care to either confirm your code is still exactly as shown in your first post, or update it correctly?

              J 1 Reply Last reply
              0
              • JonBJ JonB

                @jaouad100 said in How to solve Object::connect: No such signal:

                @sierdzio I was using the new version

                If you say you are using the "new version" syntax, we would not expect to see SIGNAL() or SLOT().

                Would you care to either confirm your code is still exactly as shown in your first post, or update it correctly?

                J Offline
                J Offline
                jaouad100
                wrote on last edited by
                #8

                @JonB I confirm that the code posted is the version I'm working on at the moment

                JonBJ 1 Reply Last reply
                0
                • J jaouad100

                  @JonB I confirm that the code posted is the version I'm working on at the moment

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by JonB
                  #9

                  @jaouad100
                  Then I think (I am not a C++-er) you'll find that as @sierdzio wrote for the old syntax you need to remove the two & characters prior to MainWindow:: in both SIGNAL() & SLOT() (because they effectively put their own & in for you) ....

                  J 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @jaouad100
                    Then I think (I am not a C++-er) you'll find that as @sierdzio wrote for the old syntax you need to remove the two & characters prior to MainWindow:: in both SIGNAL() & SLOT() (because they effectively put their own & in for you) ....

                    J Offline
                    J Offline
                    jaouad100
                    wrote on last edited by
                    #10

                    @JonB Yes I noticed that but it is not the issue

                    JonBJ 1 Reply Last reply
                    0
                    • J jaouad100

                      @JonB Yes I noticed that but it is not the issue

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on last edited by JonB
                      #11

                      @jaouad100
                      If it is not the issue, then why does your error message read:
                      qdude::MainWindow::&MainWindow::newImage(const QImage&*)
                      with that middling & in it? I believe it is....

                      If I wanted to use the old syntax, I would be writing:

                      QObject::connect(this, SIGNAL(newImage(const QImage &)), this, SLOT(setImage(const QImage &)));
                      

                      exactly as per e.g. http://doc.qt.io/qt-5/qobject.html#connect

                      J 1 Reply Last reply
                      3
                      • JonBJ JonB

                        @jaouad100
                        If it is not the issue, then why does your error message read:
                        qdude::MainWindow::&MainWindow::newImage(const QImage&*)
                        with that middling & in it? I believe it is....

                        If I wanted to use the old syntax, I would be writing:

                        QObject::connect(this, SIGNAL(newImage(const QImage &)), this, SLOT(setImage(const QImage &)));
                        

                        exactly as per e.g. http://doc.qt.io/qt-5/qobject.html#connect

                        J Offline
                        J Offline
                        jaouad100
                        wrote on last edited by
                        #12

                        @JonB Yes you're right. It was not only the reference because I tried without the reference but it didn't work but also the qualification on the names MainWindow:: I took it off and now it works, thanks!

                        1 Reply Last reply
                        1

                        • Login

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