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
void H3DNodeDEFLineEdit
::focusOutEvent(QFocusEvent *event
) {
if(event->reason() == Qt::TabFocusReason)
{
msgBox.setText("Tab for the focus out event");
msgBox.exec();
}
}
void H3DNodeDEFLineEdit::focusOutEvent(QFocusEvent *event)
{
if(event->reason() == Qt::TabFocusReason)
{
QMessageBox msgBox;
msgBox.setText("Tab for the focus out event");
msgBox.exec();
}
}
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
Bookmarks