Re: [SOLVED] What to use to make GUI's for termial apps
The key Qt4 API to consider when using QtCreator to write a GUI to execute a script (or to run an executable binary) is QProcess.
Since you probably wouldn't be loading a database or creating documents within Qt so about all you'd need is a MainWindow class, some labels to name script switches, and input textboxes, checkboxes or radio buttons to accept their settings, and a couple buttons to "Ok" or "Cancel" the action, and an "Exit" button.
The API gives more information about QProcess and how to interact with the process you've started, tell when it is over, and the results of its activities.
Originally posted by toad
The key Qt4 API to consider when using QtCreator to write a GUI to execute a script (or to run an executable binary) is QProcess.
Detailed Description
The QProcess class is used to start external programs and to communicate with them.
To start a process, pass the name and command line arguments of the program you want to run as arguments to start(). For example:
QObject *parent;
...
QString program = "./path/to/Qt/examples/widgets/analogclock";
QStringList arguments;
arguments << "-style" << "motif";
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
QProcess then enters the Starting state, and when the program has started, QProcess enters the Running state and emits started().
QProcess allows you to treat a process as a sequential I/O device. You can write to and read from the process just as you would access a network connection using QTcpSocket. You can then write to the process's standard input by calling write(), and read the standard output by calling read(), readLine(), and getChar(). Because it inherits QIODevice, QProcess can also be used as an input source for QXmlReader, or for generating data to be uploaded using QFtp.
The QProcess class is used to start external programs and to communicate with them.
To start a process, pass the name and command line arguments of the program you want to run as arguments to start(). For example:
QObject *parent;
...
QString program = "./path/to/Qt/examples/widgets/analogclock";
QStringList arguments;
arguments << "-style" << "motif";
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
QProcess then enters the Starting state, and when the program has started, QProcess enters the Running state and emits started().
QProcess allows you to treat a process as a sequential I/O device. You can write to and read from the process just as you would access a network connection using QTcpSocket. You can then write to the process's standard input by calling write(), and read the standard output by calling read(), readLine(), and getChar(). Because it inherits QIODevice, QProcess can also be used as an input source for QXmlReader, or for generating data to be uploaded using QFtp.
The API gives more information about QProcess and how to interact with the process you've started, tell when it is over, and the results of its activities.
Comment