This was made obsolete in this upstream Qt Change.
It personally concerns me that this was made obsolete leaving the API documentation reader clueless at first.
Digging a bit deeper, it seems that the reason for obsoleting this method is that QAction was moved from QtWidgets to QtGui. This is to have generic actions both in the QtWidgets and QtQuick worlds. It would be suboptimal to duplicate this in both worlds. So far so good. It makes sense.
It is also worth mentioning that the API is not yet removed. It is just deprecated. I think it would ever be removed if no one, like yourself, brings this up, or there is a proper replacement for it. So, be assured that it would not just be gone anytime soon.
Now, for the future, a QWidgetAction is represented in the containers you add it to by whatever widget you return from createWidget.
It seems that you could still use these APIs:
void QWidget::addAction(QAction *action)
and
QAction *QMenu::menuAction() const
With QWidgetAction.
If this still does not cover your use case, I would suggest to open a Jira ticket against the Qt bug tracker to propose a QMenu::setMenuInAction method to replace the obsolete.