I am a beginner in Qt and I tried for two days to find out what's wrong unfortunately I couldn't, I would really appreciate your help. I have a Set Parameters in the MainWindow, when clicking on it it launch a dialog, that allow a user to input values for x and y. I am trying to connect the signal of clicking the button OK from the dialog to connect to QAction Start button on the MainWindow, and after clicking that start button the program run, which multiply two numbers.
The errors: Static assertion failed: The slot requires more arguments than the signal provides. Signal and slot arguments are not compatible
I added here the code of my program.
mainwindow.h
```
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "dialogsetparams.h"
#include <QPushButton>
#include <QAction>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_actionSet_Parameters_triggered();
void on_actionStart_triggered(double x, double y);
signals:
void multiplySignal(double x, double y);
private:
Ui::MainWindow *ui;
DialogSetParams *dialogParams;
};
#endif // MAINWINDOW_H
```
mainwindow.cpp
```
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "dialogsetparams.h"
#include "multxy.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
// connect signal OK clicked from dialog to &QAction Start buttun in mainwindow
connect(dialogParams, &DialogSetParams::on_OKbtn_clicked, ui->actionStart, &QAction::triggered);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_actionSet_Parameters_triggered()
{
DialogSetParams *dialogParams = new DialogSetParams(this);
dialogParams->show();
}
void MainWindow::on_actionStart_triggered(double x, double y)
{
// create an instance of class BspMembraneSurf when Start button triggered
Multxy* multOp = new Multxy();
multOp->computexy(x, y);
}
```
dialogsetparams.h
```
#ifndef DIALOGSETPARAMS_H
#define DIALOGSETPARAMS_H
#include <QDialog>
#include <QObject>
namespace Ui {
class DialogSetParams;
}
class DialogSetParams : public QDialog
{
Q_OBJECT
public:
explicit DialogSetParams(QWidget *parent = nullptr);
~DialogSetParams();
double x;
double y;
public slots:
void on_OKbtn_clicked();
signals:
void setParams(double x, double y);
private:
Ui::DialogSetParams *ui;
};
#endif // DIALOGSETPARAMS_H
dialogsetparams.cpp
```
#include "dialogsetparams.h"
#include "ui_dialogsetparams.h"
#include <QPushButton>
#include <QDebug>
DialogSetParams::DialogSetParams(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogSetParams)
{
ui->setupUi(this);
// connect clicked signal to OK button slot
connect(ui->OKbtn, &QPushButton::clicked, this, &DialogSetParams::on_OKbtn_clicked);
emit setParams(x, y);
}
DialogSetParams::~DialogSetParams()
{
delete ui;
}
void DialogSetParams::on_OKbtn_clicked()
{
// Get user input from dialog
x = ui->xDoubleSpinBox->value();
y = ui->yDoubleSpinBox->value();
accept();
}
```
[Set Parameters][1]
[dialog][2]
[errors][3]
[1]: https://i.stack.imgur.com/KuVbh.png
[2]: https://i.stack.imgur.com/Rvp8e.png
[3]: https://i.stack.imgur.com/CHzJf.png