Issue with QInputMethod to handle the events

  • I am working on digital multi-meter application using Qt 5.7. There is a numeric keypad on the device. UI screen has TableView, the data is updated from model and QStyledDelegates are being used to display and edit the data. TableView has two columns, one column is editable. The QFlags have been set for the same.

    Suppose the selected ModelIndex is (row = 0 && col = 1) which is editable, when any of the numeric hard key is pressed the selected cell should get turned to edit mode (adds QLineEdit to the cell using createEditor()) and pressed digit should appear on the QLineEdit.

    We are using QInputMethod to handle the events. Whenever any key is pressed, we set the commitString() of QInputMethodEvents and post the event to focussed widget. The problem here is, the focussed widget gets the event and adds QLineEdit to the cell but not the character to the QLineEdit. Subsequent keys are accepted and appears in QLineEdit. Problem is only with the first keypress.

    Tried to override the edit() method of QAbtsractItemView but did not help.

  • @Bharath_pthinks how have you ensured the characters of respective keys pressed reaches the QLineEdit that was created?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.