[Qt-jambi-interest] a problem about QGraphicsTextItem----help

朱欢 hotaru5423 at gmail.com
Wed Jul 30 10:43:17 CEST 2008


QGraphicsView gv=new QGraphicsView();
QGraphicsScene gs=new QGraphicsScene();
QGraphicsTextItem textitem=new QGraphicsTextItem();
textitem.setDocument(ui.textEdit.document());
gs.addItem(textitem);
gv=new QGraphicsView(gs);
gv.show();
***********************************************code
above***************************************


I want use this to view the rich text in the "ui.textEdit", but the
QGraphicsView doesn't show the QGraphicsTextItem with the QTextDocument.
What's wrong with it?

And after that, I tried to change the
"textitem.setDocument(ui.textEdit.document());" into
"textitem.setHtml(ui.textEdit.toHtml());" and then it really works well
without problem.

I need the setDocument function to archive my rich text (including
images) viewer in my project.
Please help me.
Thanks a lot in deed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-jambi-interest/attachments/20080730/1a6c9206/attachment.html 


More information about the Qt-jambi-interest mailing list