SudaNix
21st October 2009, 13:51
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:
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();
The problem is the image appear in the wrong location, it should appear after the text not before it!:confused:
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.
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:
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();
The problem is the image appear in the wrong location, it should appear after the text not before it!:confused:
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.