Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why is their MainWindow:Arguments twice? What does this mean?
MainWindow::Arguments MainWindow::arguments()
{
bool ok1, ok2;
float a1 = ui->argument1Input->text().toFloat(&ok1);
float a2 = ui->argument2Input->text().toFloat(&ok2);
if (!ok1 || !ok2)
{
QMessageBox messageBox;
messageBox.setIconPixmap(QPixmap(":/icon.png"));
messageBox.setText("One of your entries is not a valid
number.");
messageBox.setWindowTitle("Error");
messageBox.exec();
}
return Arguments(a1, a2);
}

What I have tried:

Why is their MainWindow:Arguments twice? What does this mean?
MainWindow::Arguments MainWindow::arguments()
{
 bool ok1, ok2;
 float a1 = ui->argument1Input->text().toFloat(&ok1);
 float a2 = ui->argument2Input->text().toFloat(&ok2);
 if (!ok1 || !ok2)
 {
 QMessageBox messageBox;
 messageBox.setIconPixmap(QPixmap(":/icon.png"));
 messageBox.setText("One of your entries is not a valid
number.");
 messageBox.setWindowTitle("Error");
 messageBox.exec();
 }
 return Arguments(a1, a2);
}
Posted
Updated 2-Feb-21 16:36pm
Comments
CPallini 3-Feb-21 2:07am    
See also:
https://doc.qt.io/qt-5/qcoreapplication.html#arguments

1 solution

It actually isn't there twice. The language is case sensitive. The first thing, MainWindow::Arguments, is the return type of a method. I assume it is an enumeration in the MainWindow class or one of its parents. The second one, MainWindow::arguments(), is a method of the MainWindow class.
 
Share this answer
 
Comments
CPallini 3-Feb-21 2:01am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900