I spend two day to dispay and edit the XSL-Fo format is similar from dock book KDE..
now i can not grab QTextDocument to resave to xml file.
Question:
Why QTextFrame can not find image or table? inside a QTextFrame::iterator from QTextDocument

Or is image part from fragment? how grab this?

i have one image and one table inside and iterator not find? why .. pleas help .
I not found any sample to iterate QTextDocument http://doc.trolltech.com/4.2/richtext-structure.html


Qt Code:
  1. //////QTextDocument *w3 = fop.GetDoc() [ return QTextDocument->clone() ] XSL-FO format ;
  2. /////QTextFrame *Tframe = w3->rootFrame();
  3.  
  4. int speed = 0;
  5. qDebug() << "### iterator start ############################" << speed;
  6.  
  7. /* QTextFrameFormat QTextFrame::frameFormat() const */
  8.  
  9. QTextFrame::iterator it;
  10. for (it = Tframe->begin(); !(it.atEnd()); ++it) {
  11. speed++; /* to find tree structure */
  12. QTextFrame *childFrame = it.currentFrame();
  13. QTextBlock para = it.currentBlock();
  14.  
  15. if (childFrame) {
  16. qDebug() << "### frame " << speed;
  17.  
  18. } else if (para.isValid()) {
  19. qDebug() << "### block " << speed << " Paragraph ->" << para.text();
  20.  
  21. if (para.charFormat().isValid()) { /* QTextCharFormat */
  22. QTextCharFormat subpara = para.charFormat();
  23.  
  24. qDebug() << "### inline span " << speed;
  25.  
  26. if ( subpara.toImageFormat().isValid() ) {
  27.  
  28. QTextImageFormat Pic = subpara.toImageFormat();
  29. qDebug() << "### image " << speed;
  30.  
  31. } else if ( subpara.toTableFormat().isValid() ) {
  32.  
  33. QTextTableFormat Ta = subpara.toTableFormat();
  34. qDebug() << "### table " << speed;
  35. }
  36.  
  37.  
  38.  
  39. }
  40.  
  41.  
  42.  
  43. }
  44. }
  45. qDebug() << "### iterator end ############################" << speed;
To copy to clipboard, switch view to plain text mode