Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.2.6, 6.5.3
-
-
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
Issue Links
- is duplicated by
-
QTBUG-122201 [REG] QTextDocument mangles file:// URLs used to load images
-
- Closed
-
- resulted from
-
QTBUG-109212 QLabel with embedded image using 'qrc:/' will no longer load
-
- Closed
-
For Gerrit Dashboard: QTBUG-120577 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
533373,1 | QTextImageHandler: Use QUrl::toLocalFile to convert to local file name | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: NEW | 0 | 0 |
529235,10 | QTextImageHandler: Use QUrl::toLocalFile to convert to local file name | dev | qt/qtbase | Status: MERGED | +2 | 0 |
532818,2 | QTextImageHandler: Use QUrl::toLocalFile to convert to local file name | 6.7 | qt/qtbase | Status: MERGED | +2 | 0 |
532989,2 | QTextImageHandler: Use QUrl::toLocalFile to convert to local file name | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |
533252,2 | QTextImageHandler: Use QUrl::toLocalFile to convert to local file name | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |