View Full Version : lineEdit and returnPressed QT5.5

18th August 2015, 16:12
I have a number of lineEdit widgets and I'm using signal and slots to capture the returnPressed event. Which will step to the next lineEdit.
It works well except for one one hic-up. It takes two presses of the return key to get it to step.

Here is the code:
void test_Dialog::on_lineEdit_name_returnPressed()
connect(ui->lineEdit_name, SIGNAL(returnPressed()),
ui->lineEdit_address, SLOT(setFocus()));

Is there a better way to do this, or am I leaving something out?
Your advise will be must welcomed.

18th August 2015, 17:55
Your question is some how not clear.
If I am not wrong: on return pressed you are setting one more lineedit into focus right ?
if so above will take 2 return pressed events & it is not proper also as its not a unique connection.

do as below:

void test_Dialog:on_lineEdit_name_returnPressed()

If I am wrong, explain you question clearly.

18th August 2015, 18:38
Thanks parsad_N. It works just great, and much cleaner.