QTextDocument: overlay multiple items on the same cursor position
Unsolved
General and Desktop
-
I'm trying to print the "usual" form for date and signature, something like this:
Signature Date ______________ _______________
but on the signature's line I want to print a QImage (the signature).
I tried the following:QTextCharFormat charFormat; charFormat.setFontPointSize(200); QTextTableFormat tableFormat; tableFormat.setHeaderRowCount(0); tableFormat.setWidth(QTextLength(QTextLength::PercentageLength, 100)); tableFormat.setBorder(0); tableFormat.setCellSpacing(200); textTable = cursor.insertTable(2, 2, tableFormat); textTable->cellAt(0, 0).firstCursorPosition().insertText(tr("Signature"), charFormat); textTable->cellAt(0, 1).firstCursorPosition().insertText(tr("Date"), charFormat); textTable->cellAt(1, 0).firstCursorPosition().insertText("_________________________", charFormat); textTable->cellAt(1, 0).firstCursorPosition().insertImage(myQImage); textTable->cellAt(1, 1).firstCursorPosition().insertText("_________________________", charFormat);
but calling the
firstCursorPosition()
twice it just makes room for the image:Signature Date image goes here _______________ ______________
Instead I want the image is printed over the line. Because it's a png I also expect the alpha channel is honored and I can see the line behind.
How to achieve this?