Search code examples
c++qtevent-handlingkeypress

How to handle keypress events in a Qt console application?


For example, that when you press "Esc", the application ends.


Solution

  • Qt doesn't handle console events, it can just read \n-terminated lines from the console.

    You need to use native APIs or other libraries (curses).