Important: Please read the Qt Code of Conduct -

How to detect a ctrl key pressed in console?

  • I'm new to the world of QT.

    I've developed a console application that takes in user input.

    @QTextStream cin(stdin);
    QString myMessage;
    do {
    myMessage = cin.readLine();
    } while (!myMessage.isNull());@

    Now the problem is I dont know how a user can enter 'isNull' character ?!
    Another option to end this loop is to detect a special key like ctrl key or something like that.
    So how to detect a ctrl key?

  • why not simply define an 'exit' command?

  • I have no notion about it..!
    Can you give an example?

    Thanks for the reply though.

Log in to reply