2014-12-23 26 views
1

Qtleft-to-right 언어와 내 문제가 내 목표를 다루는 발생 texts.But right-to-left 언어를 처리 할 수있는 강력한 적응 방법을 제공합니다. 내가 더 내 QTextEdit 기반 위젯 어떤 그림을 붙여 넣기있어 무엇
image no.1

오른쪽에서 왼쪽으로 쓰는 언어 (eg.Arabic) 문자가 왼쪽에서 오른쪽으로 쓰는 언어처럼 동작하는 방법을 qt에서합니까?


사진 2 번을 얻을 싶은


사진 1 위 .1은
image no.2
나는 왼쪽에서 오른쪽 텍스트 방향을 설정하면 아래 그림과 같이 내가 가진 무엇


사진 3 호 :

QTextDocument *doc = ui->textEdit->document(); 
QTextOption textOption = doc->defaultTextOption(); 
textOption.setTextDirection(Qt::LeftToRight); 
doc->setDefaultTextOption(textOption); 
ui->textEdit->setDocument(doc); 

image no.3

 
Making it left-to-right aligned is not that hard,
but the result differs from what picture no.1 shows.

사진 내가
image no.4


What I want to achieve is the fact that it shows like picture no.1 does,
and key-strikes make texts appended to the terminal
when the existting texts is terminated by a Arabic notation.
In a word,all I want is that it behave like left-to-right languages do
whether it contains right-to-left language characters or not.
+1

QT가 유니 코드를 완벽하게 지원하는 경우 왼쪽에서 오른쪽으로 임베드하는 특수 문자를 사용해 볼 수 있습니다. http://www.w3.org/International/questions/qa-bidi-controls – VahidN

+0

@VahidN 감사합니다. – waterd

+0

'Qt :: Key_Direction_L' 키보드 이벤트를 위젯에 보내서 도움이되는지 확인하려고 했습니까? 이렇게 : http://stackoverflow.com/questions/27517981/how-to-display-arabic-notations-in-left-to-right-direction-in-qlineedit-qlabel-e/27518579#27518579 – Nejat

답변

1

유니 코드 Directional Formatting Characters을 제공하는 터미널에 추가 텍스트를하려고 할 때 가지고 무엇을 4 번, 그리고 Qt는 생각에서 오는 매우 좋아요 지원 @ VahidN. 내 문제는 부분적으로이 방법으로 해결됩니다. 양방향 문자열이 올바르게 표시됩니다.

QString(QChar(0x200E))+strText; //LRM 
QString(QChar(0x202D)) + strText + QString(QChar(0x202C)); //LRO...PDF 

이 질문이 있기 전에 나는 another one으로 대답했으며, 이는 아마도 자신의 해결책을 찾는데 도움이 될 것입니다.