Parentheses expected, but code has sets of parentheses
-
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?
-
@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
-
@JKSH said in Parentheses expected, but code has sets of parentheses:
parentheses
????
looks like it has parentheses -
SIGNAL and SLOT are macros. you should not put a space before their opening paren.
-
@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
-
@micha_eleric See @JKSH response above.
-
@Kent-Dorfman said in Parentheses expected, but code has sets of parentheses:
@micha_eleric See @JKSH response above.
i did, and i responded.
-
@micha_eleric said in Parentheses expected, but code has sets of parentheses:
????
looks like it has parenthesesclicked()
<-- has parenthesesCGUI::Btn_test_clicked
<-- doesn't have parentheses
And did you read the link I gave you?
-
@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 parenthesesclicked()
<-- has parenthesesCGUI::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. -
@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);
-
@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.