Tab problem is solved !
I don't think it is a Shortcut Event as StandardKey of QKeySequence does not map Tab key. I don't realy know how it is done inside Qt, I might search later.
I actualy just overrode QLineEdit::focusNextPreviousChild to do a validation check:
bool LineEdit::focusNextPrevChild(bool next)
{
if (hasAcceptableInput() == false)
{
FixInput();
return true; // To prevent searching for other widgets
}
return QLineEdit::focusNextPrevChild(next);
}
As a result, if input is invalid when the user press Tab the tooltip is shown but if the input is valid the next widget gain focus
Error2.png
Apparently I still need to have better accuracy for the position of the tooltip though
EDIT: QWidget::mapToGlobal already include the position of the widget (should have been obvious) So I just changed mapToGlobal(pos()); to mapToGlobal(s_zero); with static const QPoint s_zero = QPoint(0, 0)