Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

C++ setting parameters on shell script using GUI

views
     
TSZeneticX
post Feb 4 2016, 11:55 PM, updated 9y ago

stars for what
********
All Stars
11,768 posts

Joined: Jan 2008
From: KL - Cardiff - Subang - Sydney



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
post Feb 5 2016, 06:11 PM

New Member
*
Newbie
2 posts

Joined: Dec 2015
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
post Feb 5 2016, 08:25 PM

stars for what
********
All Stars
11,768 posts

Joined: Jan 2008
From: KL - Cardiff - Subang - Sydney



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.html
*
no. 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

 

Change to:
| Lo-Fi Version
0.0116sec    0.48    5 queries    GZIP Disabled
Time is now: 28th March 2024 - 07:25 PM