Implementing a GUI wrapper in qt
I want to implement a simple GUI in Qt using QTextEdit
. I want to get custom commands and print the results to QTextEdit
.
The code below returns the whole content QTextEdit
:
text_editor.toPlainText().toAscii();
But I donβt know how to distinguish between what the user entered and what was typed earlier. What is the correct way to do this?
source to share
Use QTextEdit for output. It supports multiple lines and you can manipulate colors using HTML. Then use a single QLineEdit line to enter commands. Place QLineEdit under QTextEdit and there you have a GUI for a simple command interface! When you enter a command in QLineEdit, also print it in QTextEdit, possibly using a different color than the command output.
It's much easier than trying to do everything with one widget.