0

I have a strange behaviour with one of my ui`s:

In my ui I have a lineEdit Shift_x and a Button pb_OK. When I do the following I have different behaviour:

  1. Edit + RETURN: When I edit the value in Shift_x and press return the slot on_lne_Shift_x_returnPressed() is executed. This is what I would expect. But after that the slot on_pb_OK_clicked() is also executed which in the end makes my program on_MoveCurve_ValueEdited to be executed twice.

  2. Edit + OK: If I edit the value in Shift_x and click “OK” only the slot on_pb_OK_clicked() is executed ( which then starts on_lne_Shift_x_returnPressed(); where the actual shift is triggered)

Why would the program run on_lne_Shift_x_returnPressed() and on_pb_OK_clicked() when I only press the return button?

Thanks for your help!

This is my code:

2 slots:

 void MoveSeries::on_lne_Shift_x_returnPressed()
 {
     const QString arg1= ui->lne_Shift_x->text();
     shift_tracker = shift_tracker-arg1.toDouble();
     emit x_returnPressed(arg1, ChartSeries);
 }


void MoveSeries::on_pb_OK_clicked()
 {     on_lne_Shift_x_returnPressed();     }

And a CONNECT in my other class

connect(  MOVE_SERIES  , SIGNAL( x_returnPressed( QString ,  QVector < Series*>   )),
              this,SLOT( on_MoveCurve_ValueEdited ( QString,QVector < Series*>))) ;
user3443063
  • 1,455
  • 4
  • 23
  • 37

0 Answers0