On Tue, Feb 7, 2012 at 1:55 PM, paulovictor.pinhe...@gmail.com < paulovictor.pinhe...@gmail.com> wrote:
> Hello there, > > I'm having a problem with QTextEdit/QTextDocument when i'm trying to > export the document to html via QTextEdit::toHtml() . The problem lies when > we insert an image using QTextDocument::addResource() and, although > QTextEdit shows it fine, it crashes when we call QTextEdit::toHtml() > function. Any words of advice? Some snippet above: > > ... > QImage img(img1Path); > > QUrl uri = QUrl::fromLocalFile(img1Path); > > m_doc->addResource(QTextDocument::ImageResource, uri, QVariant(img)); > > QTextImageFormat imageFormat; > imageFormat.setWidth(300); > imageFormat.setHeight(300); > imageFormat.setName(uri.toString()); > > cursor.insertImage(imageFormat); > ... > > // when it crashes > QString html = m_doc->toHtml(); > > It works fine when a image is not inserted. > > Att, > > Paulo Pinheiro > > Just a shoot in the dark: is it possible that imageFormat instance goes out of scope and is already destroyed by the time m_doc->toHtml() is called? Regards, diego > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest