I'm trying to work on something that involves paginated HTML.

I've run into a roadblock trying to get it to work in QML.
The standard QML Text object supports HTML just fine, but when the text runs past the end of the current height, you get this:


I couldn't find any way to draw only the text that would be visible onscreen in pure QML.
So I switched to trying creating a subclass of QQuickPaintedItem.
I thought I just have a private QTextDocument member named m_doc,
then in the paint() method, just use something like:
m_doc.drawContents(painter, QRectF(0, 0, width(), height()))

When I do that, it crashes with the message:
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QTextDocument(0x26db958), parent's thread is QThread(0x2294840), current thread is QSGRenderThread(0x27ea9c0)

What am I doing wrong here?