Thanks once again. I've found the issue and how to fix it.
Issue was: the event was sent to an object which was not in focus.
Resolution:
Before event sending I should have been get a pointer to the widget. And send event directly to this widget.
Qt Code:
  1. void my_app::key_press_release(int key, Qt::KeyboardModifiers modifier)
  2. {
  3. QWidget * widget = QApplication::focusWidget();
  4.  
  5. QKeyEvent key_press(QKeyEvent::KeyPress, key, modifier, NULL, false, 0 );
  6. QApplication::sendEvent(widget, &key_press);
  7.  
  8. QKeyEvent key_release(QKeyEvent::KeyRelease, key, modifier, NULL, false, 0 );
  9. QApplication::sendEvent(widget, &key_release);
  10. }
To copy to clipboard, switch view to plain text mode