Below is an answer.
void MyWidget::changeEvent(QEvent *event)
{
if (e->type() == QEvent::LanguageChange) {
titleLabel->setText(tr("Document Title"));
...
okPushButton->setText(tr("&OK"));
} else
QWidget::changeEvent(event);
}
code within if (e->type() == QEvent::LanguageChange) { ... )
should contain ALL the code which has to be called when language changed.
Basically every line of the code with tr() has to be called there.
In there you can put call to retranslateUi,
but retranslateUi is just a function where QtDesigner put strings created in there.
this might be or might not be sufficient for your widget.
Finally there are people who do not use designer.
That is why you could not find retranslateUi mentioned anywhere.
Keyword is tr().
For example you may fill tree widget outside of designer.
If you used text which has to be internationalized there, you need to make sure the same code is executed as a reaction on language changed.
Common logic suggests to put all code which requires initialization in a single function or slot.
Such function or slot should be called when QEvent::LanguageChange arrives.
Call this function myRetranslateUi if you want.
You do not have to subclass every widget (as suggested by example) though.
Alternative is to install event filter.