How to safely edit QTextDocument within Qml TextEdit component
-
Dear all,
I'm working on a collaborative text editor within Qml and I have experimented with the underlying mechanism within Qt C++ and it works. However, trying to implement things in Qml I seem to have run into as issue that the QTextDocument stored within a Qml TextEdit component is not to be touched as written in the documentation:
Warning: The QTextDocument provided is used internally by Qt Quick 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.
The process I ended up with was using a QTextCursor to edit the QTextDocument and I have tested it by extracting the QTextDocument within the Qml TextEdit object but I am concerned with the warning as provided within the documentation.
Is there any safe way of editing the QTextDocument? Such as with signals / slots or something? The fact that I can't edit the QTextDocument without risk of crashing seems like a rather large limitation within the design of Qml no? That it can only be modified from the UI it self?
Am I missing something ?
Thank you in advanced