A simple shell prompt with QTextEdit, or any other appropriate Qt ways.
(Using QScriptEngine as an ECMA script interpreter is assumed)
MATLAB

Python

In a shell prompt, the command line part is editable while the other parts are not.
For MATLAB, only the line after the last >> is editable; for Python shell, only the line after the last >>> is editable.
This is the first idea appear in my mind:

Using QTextEdit as read-only and QLineEdit as a command entry.
For the purpose of pure functionality, it's acceptable, but not good enough.
Actually the same question could be found here: Implementing a GUI Shell in qt, and the accepted answer is just the same as this workaround. Just like I said, the workaround is not good enough. I am wondering if it's possible to emulate a shell prompt with Qt? Currently, QTextEdit seems to be the best class to start.
Any ideas are welcome. Codes are welcome too but not needed, all I need are just some hints and directions.
You can take a look at QConsole which is a custom widget that implements a basic console and inherits from QTextEdit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With