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. Parentheses expected, but code has sets of parentheses

Parentheses expected, but code has sets of parentheses

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 4 Posters 2.9k 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.
  • M Offline
    M Offline
    micha_eleric
    wrote on last edited by
    #1

    error:

    QObject::connect: Parentheses expected, slot QMainWindow::CGUI::Btn_test_clicked in ../GUI/CGUI.cpp:2518
    QObject::connect:  (sender name:   'pushButton_22')
    QObject::connect:  (receiver name: 'MainWindow')
    Press <RETURN> to close this window...
    

    code at line 2518:

    ui->pushButton_22->connect(ui->pushButton_22, SIGNAL (clicked()),this, SLOT (CGUI::Btn_test_clicked) );
    

    is it complaining about somewhere else?

    JKSHJ JonBJ 2 Replies Last reply
    0
    • M micha_eleric

      error:

      QObject::connect: Parentheses expected, slot QMainWindow::CGUI::Btn_test_clicked in ../GUI/CGUI.cpp:2518
      QObject::connect:  (sender name:   'pushButton_22')
      QObject::connect:  (receiver name: 'MainWindow')
      Press <RETURN> to close this window...
      

      code at line 2518:

      ui->pushButton_22->connect(ui->pushButton_22, SIGNAL (clicked()),this, SLOT (CGUI::Btn_test_clicked) );
      

      is it complaining about somewhere else?

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @micha_eleric CGUI::Btn_test_clicked needs parentheses.

      But anyway, the new syntax is more recommended nowadays: https://doc.qt.io/qt-5/signalsandslots-syntaxes.html

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      M 1 Reply Last reply
      3
      • JKSHJ JKSH

        @micha_eleric CGUI::Btn_test_clicked needs parentheses.

        But anyway, the new syntax is more recommended nowadays: https://doc.qt.io/qt-5/signalsandslots-syntaxes.html

        M Offline
        M Offline
        micha_eleric
        wrote on last edited by
        #3

        @JKSH said in Parentheses expected, but code has sets of parentheses:

        parentheses

        ????
        looks like it has parentheses

        JKSHJ 1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by Kent-Dorfman
          #4

          SIGNAL and SLOT are macros. you should not put a space before their opening paren.

          If you meet the AI on the road, kill it.

          M 1 Reply Last reply
          1
          • Kent-DorfmanK Kent-Dorfman

            SIGNAL and SLOT are macros. you should not put a space before their opening paren.

            M Offline
            M Offline
            micha_eleric
            wrote on last edited by
            #5

            @Kent-Dorfman said in Parentheses expected, but code has sets of parentheses:

            SIGNAL and SLOT are macros. you should not put a space before their opening paren.

            i removed spaces, and same errors

            Kent-DorfmanK 1 Reply Last reply
            0
            • M micha_eleric

              @Kent-Dorfman said in Parentheses expected, but code has sets of parentheses:

              SIGNAL and SLOT are macros. you should not put a space before their opening paren.

              i removed spaces, and same errors

              Kent-DorfmanK Offline
              Kent-DorfmanK Offline
              Kent-Dorfman
              wrote on last edited by
              #6

              @micha_eleric See @JKSH response above.

              If you meet the AI on the road, kill it.

              M 1 Reply Last reply
              0
              • Kent-DorfmanK Kent-Dorfman

                @micha_eleric See @JKSH response above.

                M Offline
                M Offline
                micha_eleric
                wrote on last edited by
                #7

                @Kent-Dorfman said in Parentheses expected, but code has sets of parentheses:

                @micha_eleric See @JKSH response above.

                i did, and i responded.

                1 Reply Last reply
                0
                • M micha_eleric

                  @JKSH said in Parentheses expected, but code has sets of parentheses:

                  parentheses

                  ????
                  looks like it has parentheses

                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #8

                  @micha_eleric said in Parentheses expected, but code has sets of parentheses:

                  ????
                  looks like it has parentheses

                  • clicked() <-- has parentheses
                  • CGUI::Btn_test_clicked <-- doesn't have parentheses

                  And did you read the link I gave you?

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  M 1 Reply Last reply
                  0
                  • JKSHJ JKSH

                    @micha_eleric said in Parentheses expected, but code has sets of parentheses:

                    ????
                    looks like it has parentheses

                    • clicked() <-- has parentheses
                    • CGUI::Btn_test_clicked <-- doesn't have parentheses

                    And did you read the link I gave you?

                    M Offline
                    M Offline
                    micha_eleric
                    wrote on last edited by
                    #9

                    @JKSH said in Parentheses expected, but code has sets of parentheses:

                    @micha_eleric said in Parentheses expected, but code has sets of parentheses:

                    ????
                    looks like it has parentheses

                    • clicked() <-- has parentheses
                    • CGUI::Btn_test_clicked <-- doesn't have parentheses

                    And did you read the link I gave you?

                    thank you for the explanation.
                    and yes, i am reading the link you posted. got questions, trying to figure it out.

                    JKSHJ 1 Reply Last reply
                    0
                    • M micha_eleric

                      error:

                      QObject::connect: Parentheses expected, slot QMainWindow::CGUI::Btn_test_clicked in ../GUI/CGUI.cpp:2518
                      QObject::connect:  (sender name:   'pushButton_22')
                      QObject::connect:  (receiver name: 'MainWindow')
                      Press <RETURN> to close this window...
                      

                      code at line 2518:

                      ui->pushButton_22->connect(ui->pushButton_22, SIGNAL (clicked()),this, SLOT (CGUI::Btn_test_clicked) );
                      

                      is it complaining about somewhere else?

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #10

                      @micha_eleric
                      Your original, old-style should have read like this:

                      ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()), this, SLOT(CGUI::Btn_test_clicked()) );
                      

                      And the preferable, new-style equivalent would be:

                      ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked);
                      
                      M 1 Reply Last reply
                      4
                      • JonBJ JonB

                        @micha_eleric
                        Your original, old-style should have read like this:

                        ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()), this, SLOT(CGUI::Btn_test_clicked()) );
                        

                        And the preferable, new-style equivalent would be:

                        ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked);
                        
                        M Offline
                        M Offline
                        micha_eleric
                        wrote on last edited by micha_eleric
                        #11

                        @JonB

                        thank you. i was about half way there

                        1 Reply Last reply
                        0
                        • M micha_eleric

                          @JKSH said in Parentheses expected, but code has sets of parentheses:

                          @micha_eleric said in Parentheses expected, but code has sets of parentheses:

                          ????
                          looks like it has parentheses

                          • clicked() <-- has parentheses
                          • CGUI::Btn_test_clicked <-- doesn't have parentheses

                          And did you read the link I gave you?

                          thank you for the explanation.
                          and yes, i am reading the link you posted. got questions, trying to figure it out.

                          JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by
                          #12

                          @micha_eleric said in Parentheses expected, but code has sets of parentheses:

                          thank you for the explanation.

                          You're most welcome.

                          and yes, i am reading the link you posted. got questions, trying to figure it out.

                          Feel free to post your questions here.

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          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