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

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

    XMLWordPrintable

Details

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

    Description

      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>
      

      Attachments

        1. mywrite-dev1-qt-bug.zip
          102 kB
        2. ntscreenshot_20240107_143610.png
          ntscreenshot_20240107_143610.png
          34 kB
        3. qt-bug.png
          qt-bug.png
          105 kB
        4. qt-bug-1.png
          qt-bug-1.png
          10 kB

        Issue Links

          For Gerrit Dashboard: QTBUG-120577
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: