I want to connect my QLineEdtit's widget to inputValueTest slots, in the same class.
The slot allow to read the value in QLineEdit and change it in an another class in my project.
When i create the slot, I pass in parameter the string.
QGroupBox *Interface::createValuesGroup()
{
QLineEdit *line_value1 = new QLineEdit();
QPushButton *input_values= new QPushButton("Input Values");
QGroupBox *group_box = new QGroupBox("Values Parameters");
QLabel *label_value1 = new QLabel("Value 1 :");
QGridLayout *gridbox_layout = new QGridLayout;
//Place widget in layout
gridbox_layout->addWidget(line_value1,0,1);
gridbox_layout->addWidget(label_value1,0,0);
gridbox_layout->addWidget(input_values,4,0,1,2);
group_box->setMaximumWidth(200);
//set layout and disable it
group_box->setLayout(gridbox_layout);
group_box->setDisabled(true);
QString s = line_value1->text();
connect(line_value1, &QLineEdit::editingFinished, this, &Interface::inputValueTest(s));
connect(input_values, &QPushButton::clicked, this, &Interface::inputValues);
return group_box;
}
//It's the slot
void Interface::inputValueTest(QString str_value)
{
reseau->getFils(0).setStr_val(str_value);
}
But, i've an error :
error : lvalue required as unary ‘&’ operand
141 | connect(line_value1, &QLineEdit::editingFinished, this, &Interface::inputValueTest(s));
| ^