Qt Console with Bash

后端 未结 2 1507
长发绾君心
长发绾君心 2021-01-25 04:27

I am writing a program using the Qt framework. I would like the user to be able to have access to a console/terminal from within the application itself.

In other words,

相关标签:
2条回答
  • 2021-01-25 05:19

    There is really not much tutorial needed for QTermWidget, although there is one here.

    The purpose of the widget is that it does not require any complication. The code would be something like this without the extra settings:

    QTermWidget *console = new QTermWidget();
    QMainWindow *mainWindow = new QMainWindow();
    mainWindow->setCentralWidget(console);
    

    It is also not necessarily true that it is not up-to-date. It was recently updated to build against Qt 5 properly. If you lack anything, please use the issue tracker on github.

    It should be more or less in mature and "complete" state, that is why you may not see heavy progress. It is just a widget after all, not a big framework.

    0 讨论(0)
  • 2021-01-25 05:19

    You could try QProcess. This is not strictly "embedding" a terminal in your app, but it it really easy to use, you can kick off a terminal that is owned by your app. You can even connect (with signals / slots) to its output and interact with it in a limited fashion... depends on what you need.

    Here is the doc with some simple examples: http://qt-project.org/doc/qt-5/QProcess.html

    I am not at my Qt-PC today so I don't have an "interacting" example for you, but if you think this is a way for you to go then I can dig that out...

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