Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-126267

QQuickTextDocument::setTextDocument disables TextEdit

    XMLWordPrintable

Details

    • d35e367e4 (dev), 5c7569454 (6.8), 8275f5e8a (6.7)

    Description

      Reproducer that builds with 6.7.1 attached. Basically, a TextEditHandler classes is going to modify QTextDocument owned by QQuickTextDocument in either way:
      1. Swap in new QTextDocument (see TextEditHandler.h line 14~16 )
      2. Edit existing QTextDocument (see TextEditHandler.h line 18)

      The former does not work but the latter does. Build and run reproducer
      1. Type something in TextEdit (nothing at all is fine too)
      2. You will see console outputs new text
      3. Click button "resetTextDocument" which is supposed to show "Hello World" in TextEdit
      4. Result is that nothing happens, i.e. no new text. "textChanged" signal is not emitted either. And even worse: TextEdit becomes unusable and stops responding to anything
      5. Click button "debugTextDocument" and console outputs

      void __cdecl TextEditHandler::debug(class QQuickTextDocument *) "Hello World!" 
      

      which implies that Qt does think TextEdit holds "Hello World" now.

      But with the latter (comment out TextEditHandler.h line 14~16 and uncomment line 18) everything works just as expected.

      IDK why I can only edit existing document but not swapping in new document.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              srutledg Shawn Rutledge
              luqiaochen Luqiao Chen
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes