The following is the code snippet.
validateFields() is the function that does the work of validations and returns the appropriate int value depending upon the validation, based on which one either sets an alert or appends the data. However, the problem I face is that I am unable to continue editing data on the dialog box after the edit message is displayed.

Ex:- The user first enters all the fields. Upon clicking on Ok, the validator checks all the fields, In case the name doesn't meet the criteria, it shows an Alert and upon closing it the dialog remains with the original values that were entered. However I am unable to edit the values in the lineedits and continue making changes in the dialog. Any help will be welcome.

Qt Code:
  1. NewContactDialog d;
  2. int r_val= d.exec();
  3. int field_val=d.validateFields();
  4. if(r_val==1){
  5.  
  6. switch(field_val){
  7. case 1:
  8. d.setName();
  9. d.appendData();
  10. break;
  11. case 2:
  12. QMessageBox::information(this,"Alert","Please enter only characters [a-z][A-Z] for the Name field.",QMessageBox::Ok);
  13. d.exec();
  14. break;
  15.  
  16. default:
  17. d.exec();
  18. }
To copy to clipboard, switch view to plain text mode