To append Resource on QTextDocument i write on this way:
doc->addResource( QTextDocument::ImageResource, QUrl(filefullpath), QPixmap(filefullpath) );

if file exist..

But on export on other format not HTML i like to export the image as copy to.. on same path from export file.

and QTextImageFormat isValid done only by image on qrc resource file... inside ..
all other is display correct image on (QTextBrowser/QGraphicsItem) but QTextImageFormat Pics is false on export, why? i read only the same QTextDocument.

Qt Code:
  1. /* QTextImageFormat Pics */
  2.  
  3. if (Pics.isValid() && Pics.hasProperty(QTextFormat::ImageName) ) {
  4. /* IMAGE TAG internal external............TAGNR. ENUM 417/418 */
  5. /* SVG convert to png transparent ! / original svg base64 encoded data! xml */
  6. QDomElement inlineimage = createElement("fo:internal-graphic");
  7. const QString hrefadress = Pics.name();
  8. qDebug() << "### image 1 name() " << hrefadress;
  9. /* probe to save on export path */
  10. QFileInfo fimp(hrefadress);
  11. QPixmap lodingimage(hrefadress);
  12.  
  13. if (!lodingimage.isNull()) {
  14. QString path = imagepathexport;
  15. if (!path.endsWith("/")) {
  16. path.append("/");
  17. }
  18. QDir deop(path);
  19. if (!deop.exists()) {
  20. deop.mkpath(path);
  21. }
  22.  
  23. QString ext = fimp.completeSuffix();
  24. ext.toUpper();
  25. QByteArray extension;
  26. extension = ext.toAscii();
  27. QPixmap PicCopy(lodingimage);
  28. const QString filepathgo = path+fimp.fileName();
  29. bool ActionSave = PicCopy.save(filepathgo,extension.data(),100);
  30. qDebug() << "### image 2" << filepathgo << " bool->" << ActionSave;
  31. inlineimage.setAttribute("src",fimp.fileName());
  32. inlineimage.setAttribute("height",QString("%1pt").arg(lodingimage.height()));
  33. inlineimage.setAttribute("width",QString("%1pt").arg(lodingimage.width()));
  34. } else {
  35. /* save only url if not load */
  36. }
  37.  
  38. }
To copy to clipboard, switch view to plain text mode