19 #include <QDomDocument>
24 , mDocument( new QTextDocument( QString() ) )
26 mDocument->setUseDesignMetrics(
true );
33 c->setDocument( mDocument.get() );
39 return mDocument.get();
45 mDocument.reset( doc->clone() );
53 QPainter *painter = context.
painter();
61 const double scaleFactor = context.
painter()->device()->logicalDpiX() / 96.0;
62 context.
painter()->scale( scaleFactor, scaleFactor );
65 mDocument->setTextWidth( size.width() );
67 QRectF clipRect = QRectF( 0, 0, size.width(), size.height() );
68 if ( painter->hasClipping() )
73 clipRect = clipRect.intersected( painter->clipRegion().boundingRect() );
76 mDocument->drawContents( painter, clipRect );
83 QDomElement annotationElem = doc.createElement( QStringLiteral(
"TextAnnotationItem" ) );
86 annotationElem.setAttribute( QStringLiteral(
"document" ), mDocument->toHtml() );
88 _writeXml( annotationElem, doc, context );
89 elem.appendChild( annotationElem );
94 mDocument.reset(
new QTextDocument );
95 mDocument->setHtml( itemElem.attribute( QStringLiteral(
"document" ), QString() ) );
96 QDomElement annotationElem = itemElem.firstChildElement( QStringLiteral(
"AnnotationItem" ) );
97 if ( !annotationElem.isNull() )