Hello,
I have a problem in inserting image in RightToLeft QTextEdit.
What i want is to insert some text then insert image.
I try the following code:
QTextOption option
=textEdit
->document
()->defaultTextOption
();
option.setTextDirection(Qt::RightToLeft); // RTL.
textEdit->document()->setDefaultTextOption(option);
cursor.insertText("مرحبا بكم في كيوتي العربي"); // insert Arabic text
imageFormat.setName(":/images/jumpy.gif");
cursor.insertImage(imageFormat); // then insert the Image.
textEdit->show();
QTextEdit* textEdit = new QTextEdit;
QTextOption option=textEdit->document()->defaultTextOption();
option.setTextDirection(Qt::RightToLeft); // RTL.
textEdit->document()->setDefaultTextOption(option);
QTextCursor cursor = textEdit->textCursor();
cursor.insertText("مرحبا بكم في كيوتي العربي"); // insert Arabic text
QTextImageFormat imageFormat;
imageFormat.setName(":/images/jumpy.gif");
cursor.insertImage(imageFormat); // then insert the Image.
textEdit->show();
To copy to clipboard, switch view to plain text mode
The problem is the image appear in the wrong location, it should appear after the text not before it!
How i can solve it ?
I also try to change the current block format direction but it did not solve the problem.
Thanks in advance.
Bookmarks