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

qt6.5.3 QTextEdit can't display image ! but qt5.15 is ok 。

XMLWordPrintable

    • Windows
    • 52a41bac7 (dev), 66b732244 (6.7), e2f360844 (6.6), e05a08b8e (tqtc/lts-6.5)

      The following code . It is correct on qt5.15. But there is an error in qt6.5.3.

      QUrl localPicUrl = QUrl::fromLocalFile(localPicPath);
      document()->addResource(QTextDocument::ImageResource, localPicUrl, img);
      textCursor().insertImage(localPicUrl.toString());
      

      I found that on Windows, there is support for image paths and the file:///prefix cannot be used.

      But there is no problem with qt5.15, while qt6.5.3 is incorrect and unable to load images.

      Also, if it's macos, there is no such issue with qt6.5.3.

      Here, it should be that QT6 is not compatible with QT5, and the performance of Mac OS and Windows is different.

      I think this should be a mistake. If not modified, a large number of rich text images under qt5 will not be displayed under qt6.5. This workload and error are unacceptable.

      qt5.15 like this:(windows)

      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="file:///F:/work/pic/2023-10-04_22-53-33.png" /></p>
      

      qt6 must like this:(windows)

      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="F:/work/pic/2023-10-04_22-53-33.png" /></p>
      

        1. ntscreenshot_20240107_143610.png
          34 kB
          yin zuowei
        2. mywrite-dev1-qt-bug.zip
          102 kB
          yin zuowei
        3. qt-bug.png
          105 kB
          yin zuowei
        4. qt-bug-1.png
          10 kB
          yin zuowei
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            zuoweiyin yin zuowei
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: