I'm not gonna write again what is already in the official example. It does use QOpenGLPaintDevice. Are you sure you read it?
This is the relevant code from the link above (with my comments):
@
void OpenGLWindow::render(QPainter *painter)
{
//delete that line and put your text drawing here eg.
//painter->drawText(10, 10, "Hello world!");
Q_UNUSED(painter);
}