Currently I insert a block containing a newline character to do this:
QTextDocument* myDocument = new QTextDocument(textEdit);
textEdit->setDocument(myDocument);
QTextCursor* myCursor = new QTextCursor(myDocument);
// Insert an image
QTextImageFormat imageFormat;
imageFormat.setName("logo.jpg");
myCursor->insertImage(imageFormat, QTextFrameFormat::InFlow);
myCursor->insertText("\n");
// Insert normal text
myCursor->movePosition(QTextCursor::End);
myCursor->insertText("test");
This seems pretty hacky. Is there a better way to make the next block of text start below the image, rather than to the right of it?
I think this is the best option You have..
Though, Your code always get a brand new QTextDocument.
Based on what Your ultimate goal is, maybe You would like to use
instead of