How can I emulate a shell scripting environment using QTextEdit?

[Goal]

A simple command line prompt with QTextEdit

or any other suitable Qt way.

(used QScriptEngine

as an ECMA script interpreter)


[Example]

MATLAB

enter image description here

Python

enter image description here

On the command line, part of the command line is editable and the rest are not. For MATLAB, only the line after the last one is available >>

; only the line after the last is available to the Python shell >>>

.


[Bypass]

This is the first thought that pops into my head:

enter image description here

Using QTextEdit

both read-only and QLineEdit

as a command. For pure functionality, this is acceptable, but not sufficient.

[Question]

Actually the same question can be found here: Implementing a GUI wrapper in qt and the accepted answer is the same as this workaround. As I said, the workaround isn't enough. I'm wondering if it is possible to emulate the command line with Qt? QTextEdit

Seems to be the best senior class currently .

Any ideas are appreciated. Codes are welcome but not needed, all I need are some hints and directions.

+3


source to share


1 answer


You can take a look at QConsole , which is a custom widget that implements the base console and inherits from QTextEdit

.



+2


source







All Articles