Implementing a GUI Shell in qt

后端 未结 2 509
夕颜
夕颜 2021-01-27 20:22

I want to implement a simple graphical shell in Qt using a QTextEdit. I want to get user commands and print the results in that QTextEdit.

The

相关标签:
2条回答
  • 2021-01-27 21:02

    Reimplement the key press event handler to do it's normal work, but also to save the user typed data. Once enter is pressed, the separately saved text is executed and then cleared.

    0 讨论(0)
  • 2021-01-27 21:06

    Use QTextEdit for output. It supports multiple lines and you can control colors using HTML. Then use single line QLineEdit for entering commands. Place the QLineEdit under the QTextEdit and there you have a GUI for a simple command interface! When you enter a command to the QLineEdit, print it to the QTextEdit too, perhaps using different color than the results of the command.

    This is much easier than trying to do everything with one widget.

    0 讨论(0)
提交回复
热议问题