bringing up a InputWindow on OSX for text input while typing text with asian laguage
AnkurSharma last edited by
I am working on an text editor application.
Where the user is allowed to input text in any of the available input methods ( keyboards ).
So I was using a QWidget to render the text once input by the user. I was really happy with the way it was going but then I entered into the realm of Asian languages, where the keyboard is not having 1 to 1 mapping with the standard keyboard. So in Japanese and Chinese languages 1 letter can be composed of multiple keystrokes.
I have been working on OSX and was hoping to create some similar text input experience as that of the apple TextEdit app. So when a japanese user writes a long word he see an underline under the word which he has typed ( I could achieve this far based on the length on the inputMethod::preEditString string in my application as well ) BUT when he hits a space-bar he can see a split underline under his word in case of apple TextEdit, these splits represents the logical splits of his words which can be replaced by the prediction words given on the UI component.
Correct me if I am wrong but I think Qt does not provides any support to determine those splits on requesting for the prediction UI component. I checked on native Qt text widgets ( QLineEdit / QTextEdit ) there again I do not see the user experience like native cocoa based text editors, On QLineEdit/TextEdit some how the cursor position represents the position till the text will be replaced.
I simply found the document too insufficient in explaining on how to achieve this behavior while implementing my Text Editor. Can somebody kindly explain how to find the position on the preEdit string to which the text will be replaced on selecting something from the prediction UI component, this should certainly be possible since Qt is doing it with its native widgets.
I also looked for some other alternatives like providing OS specific dialog for adding text directly. Question( http://stackoverflow.com/questions/36337063/bringing-up-a-inputwindow-on-osx-for-text-input-while-typing-text-with-asian-lag ).
But it all looks like a dead end.!
Is there any possible way to use QInputMethod, inputMethodQuery, inputMethodEvent so as to figure out the cursor position inside the preedit string till which the text is going to be replaced on selecting some text from UI component.?