[Development] QQuickTextDocument and changing internal state of QTextDocument

Cornelius Hald hald at icandy.de
Fri Jul 5 11:13:19 CEST 2013


Hi,

I've asked this before on the "interest" list, but got now response.
Maybe this here is the better place to ask...

I'm very happy to see that it is finally possible to get the
QTextDocument of a 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::StartOfBlock);
c.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 2);
c.removeSelectedText();

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.

Thanks!
Conny





More information about the Development mailing list