Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to safely edit QTextDocument within Qml TextEdit component

How to safely edit QTextDocument within Qml TextEdit component

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qml texttextdocumentqt6text editor
1 Posts 1 Posters 274 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ChiefyChief
    wrote on 22 Apr 2023, 19:43 last edited by ChiefyChief
    #1

    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

    1 Reply Last reply
    0

    1/1

    22 Apr 2023, 19:43

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved