console, input, noecho

  • Does Qt provide a portable way to read a character from console without waiting for "Enter" and with no echo? On Windows it's "_getch()", but on Linux you have to configure stdin using termios.h -> tcsetattr(). I hear on Mac it's something else...
    Thanks in advance.

  • Qt Champions 2017

    I don't know about the "echo", I don't think Qt provides a way to configure the terminal (it'd go way beyond scope), however you can read from the standard input with QTextStream in a portable manner:

    QTextStream cin(stdin);
    QChar character;
    cin >> character;

    Kind regards.

Log in to reply

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