Hello forum,

i have a line edit and i want to do some validation check upon the focus out event. If the validation returns a false i show a message box set the focus back to the line edit and the cursor as well. Otherwise the focus moves along with the cursor to the other widget in the layout.I am over-ridding the focusOutEvent() function as follows:

This is the minimal example i think

Qt Code:
  1. void H3DNodeDEFLineEdit::focusOutEvent(QFocusEvent *event)
  2. {
  3. if(event->reason() == Qt::TabFocusReason)
  4. {
  5. QMessageBox msgBox;
  6. msgBox.setText("Tab for the focus out event");
  7. msgBox.exec();
  8.  
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 

Now i am having the following behavior:

With the tab key i get the message box and the focus moves to another widget along with the cursor. But the current line edit still holds the focus and the cursor. How to remove this ?


Thanks
Sajjad