Outline ·
[ Standard ] ·
Linear+
C++ setting parameters on shell script using GUI
TSZeneticX
|
Feb 4 2016, 11:55 PM, updated 9y ago
|
|
I'm currently coding a QT GUI for a program. What I want to achieve now is for example: Let's say in the GUI there's an option call Numbers, I select 1 (just an example) Then the code will write CODE gnome-terminal -x bash -c "-number 1 exec $SHELL" into a shell script, which will be executed when I click the run program button on the GUI is there any way to achieve this? Using C++ btw This post has been edited by ZeneticX: Feb 5 2016, 08:43 PM
|
|
|
|
emfytech
|
Feb 5 2016, 06:11 PM
|
New Member
|
Do you mean something like this: CODE QObject *parent;
QString progName = "gnome-terminal"; QStringList arguments; arguments << "-x bash" << "-c \"-number 1 exec $SHELL\"";
QProcess *myProcess = new QProcess(parent); myProcess->start(progName, arguments);
See more information about QProcess here: http://doc.qt.io/qt-5/qprocess.html
|
|
|
|
TSZeneticX
|
Feb 5 2016, 08:25 PM
|
|
QUOTE(emfytech @ Feb 5 2016, 06:11 PM) Do you mean something like this: CODE QObject *parent;
QString progName = "gnome-terminal"; QStringList arguments; arguments << "-x bash" << "-c \"-number 1 exec $SHELL\"";
QProcess *myProcess = new QProcess(parent); myProcess->start(progName, arguments);
See more information about QProcess here: http://doc.qt.io/qt-5/qprocess.htmlno. I'm already able to start the terminal and script using QProcess, but only with hard coded arguments on the script what I want to know now is there any way to modify the arguments on the script as users make selection on the GUI? In any form of C++ code
|
|
|
|