PDA

View Full Version : Drawing QImage inside QTextDocument



giusepped
13th April 2009, 08:52
I would like to draw an Image inside a QText Document.
I used the code:



QImage geometry(300,200,QImage::Format_Mono);
QPainter painter(&geometry);
painter.setPen(QPen(Qt::black,12,Qt::SolidLine,Qt: :RoundCap));

QLineF line1(10,80,80,80);
QLineF line2(10,10,80,80);
painter.drawLine(line1);
painter.drawLine(line2);

m_cursor.insertImage(geometry);
m_document->print(&printer);

where m_cursor is a QTextCursor on QTextDocument.
Hower, when I print the document on a pdf printer, I get an obscure image (no lines at all!).
Any idea?