[Interest] QQuickTextDocument and changing internal state of QTextDocument

Cornelius Hald hald at icandy.de
Fri Jun 28 13:35:24 CEST 2013


I'm very happy to see that it is finally possible to get the
QTextDocument of an QtQuick TextEdit element. Unfortunately the
documentation for QQuickTextDocument states the following:

You are not allowed to modify the document, [...]

Warning: The QTextDocument provided is used internally by QtQuick
elements to provide text manipulation primitives.

You are not allowed to perform any modification of the internal state of
the QTextDocument. If you do, the element in question may stop
functioning or crash.

Does anyone knows what exactly that means? I've written a small sample
that edits the document, for example by removing characters. So far
nothing has crashed yet.

// Seems to work fine...
QTextCursor c(m_document);
c.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 2);

Since I'm thinking about doing an editor on top of QtQuick 2.1, I'd be
happy to first know the exact limitations of this approach.


More information about the Interest mailing list