I have a GUI application, which creates a QProcess
inside, catches its output and shows it on a form. I need to somehow catch key events from the form to pass them to QProcess
(to make it fell as close as possible to real terminal window).
So, I suppose, I should process keyReleaseEvent()
and somehow transform either event.text()
(which is QString
) or event.key()
(which is int
) to argument, suitable for process.write()
(which takes char*
or QByteArray
). Is there some recommended way to do such a conversion (taking into account localization issues, ctrl/alt/shift modifiers and so on)? I do not really want to construct some sort of mapping from key()
return values to char*
strings; and text()
drops modifiers.
Moreover, if I start process with command bash -c sudo something
in QProcess, it exits instantly, complaining that "no tty present and no askpass program specified", so I may be doing something completely wrong...