Q:

Qt keyboard input in other language

Well in word processors, when I change font to Preeti, typing "asdfgh" will result in displaying "बकमानज". I tried changing QPlainTextEdit's font to  Preeti, but it's still typing "asdfgh"
How can achieve same in Qt?
Here's what I am doing:
@pyqtSlot()
def select_font(self):
    font, ok = QFontDialog.getFont(self)
    if ok:
        ## the text in ui.text_edit is in unicode
        self.ui.text_edit.setFont(font)

Obviously the font exists in the system. The displaying of font is also correct (when loaded from .txt file). What's not working is typing in that font. The key-mapping from keyboard to the chosen font is what i am talking about.
Help in c++ or python: language doesn't matter here.

A:

It is possible that the font is not being recognized in your application. Check to see if you have installed the font. You can also try adding the preeti.ttf file to resources and adding it to the app using:
QFontDatabase::addApplicationFont(“:/fonts/preeti.ttf”);

I found stylesheets to be more reliable (than using setFont(QFont)) for setting font. Use textEdit->setStyleSheet(font-family: 'Preeti');.
EDIT
setting stylesheet from QFontDialog() can be done in following way in python
@pyqtSlot()
def select_font(self):
    font, ok = QFontDialog.getFont(self)
    if ok:
        params = font.toString().split(",") # The string is :"Preeti,9,-1,5,50,0,0,0,0,0"
        self.ui.text_edit.setStyleSheet("font-family :%s;font-size:%spt;" % (params[0], params[1]))

