I think i've found a solution.
First, i install an eventFilter in my custom editor widget B on the internal spinbox :
internalSpinbox->installEventFilter(this);
Then, i implement eventFilter to treat the events on the spinbox and duplicate them to the parent:
bool AbstractRatioQuantitySpinbox::eventFilter(QObject *object, QEvent *event)
{
// cf http://stackoverflow.com/questions/12145522/why-pressing-of-tab-key-emits-only-qeventshortcutoverride-event
if (event->type() == QEvent::KeyPress)
{
auto keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Tab || keyEvent->key() == Qt::Key_Backtab) {
QApplication::postEvent(
this, new QKeyEvent(keyEvent->type(), keyEvent->key(), keyEvent->modifiers()));
return true;
}
}
else if (event->type() == QEvent::FocusOut)
{
auto focusEvent = static_cast<QFocusEvent *>(event);
QApplication::postEvent(this, new QFocusEvent(focusEvent->type(), focusEvent->reason()));
return false;
}
return QWidget::eventFilter(object, event);
}