For example, that when you press "Esc", the application ends.
相关问题
- Sorting 3 numbers without branching [closed]
- QML: Cannot read property 'xxx' of undefin
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
相关文章
- ubuntu20.4中c#通过c++库调用python脚本
- Qt槽函数自动执行多遍
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
If you need only 'quit' maybe the following snippet will help (c++11 and qt5 required):
Here is a workaround for linux. Using these posts
Capture characters from standard input without waiting for enter to be pressed https://stackoverflow.com/a/912796/2699984
I've made it like this:
ConsoleReader.h
ConsoleReader.cpp
And then just start new thread to read keys:
*UPDATED (added restoring terminal settings on quit)
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).