PDA

View Full Version : form action



collycrk
3rd September 2015, 16:52
I'm as green as a newbie can be to QT5,4.
The question I have concerns the form I have.


void ACemployee_Dialog::on_lineEdit_name_returnPressed( )
{
name = ui->lineEdit_name->text();
if(name == ""){
QMessageBox msgBox;
msgBox.setText("Name can not be blank, please enter a value.");
msgBox.exec();
ui->lineEdit_name->setFocus();
}
else {
ui->label_status->setText(name);
ui->lineEdit_address->setFocus();
}
}

It works well but i ran across a 'feature'. When filling out the lineEdit and an error is notice in a lineEdit above the current lineEdit above, and one clicks on the lineEdit
in question and corrects the error the form has to be reset.
The window does not have to be closed and reopen but one has to start from the beginning of the form.

Thanks in advance for your wisdom.

anda_skoa
3rd September 2015, 18:16
What do you mean with "the form has to be reset"?
Or more precisely: what it actually your question?

Cheers,
_

collycrk
3rd September 2015, 19:09
Well, say I was on line 3 of the form and there was an error in a line above, say line1. Line1 was edited. Click back to line 3 and finish the form. When it was executed got a 'hic-up' and no insert. Reinserted the data from line1 to end. Executed and insert was there.

I can't get it to happen again. I changed to use arg1. Don't know if that had anything to do with it. My experience with other languages tells me that is a slim change.

Thanks for your reply. :)

anda_skoa
4th September 2015, 08:37
So the problem does no longer appear, or at least not right now?

In any case, you might want to connect to "editingFinished" instead, this is also triggered when the focus leaves the line input (user using TAB or mouse to move input).
Also name.isEmpty()

Cheers,
_