View Single Post
d-iivil's Avatar
Posts: 2,154 | Thanked: 2,186 times | Joined on Dec 2009 @ Hellsinki, Finland
#10
Originally Posted by TNiga View Post
If you want to run your shell script in the button handler, you need to use function int QProcess::execute ( const QString & program, const QStringList & arguments ).

In above example from Nathraiben you would call it in function hello like this:
Code:
void MainWindow::hello()
{
    QStringList arguments;
    arguments << "Enable custom transitions" << "Droid Sans" << "Black";
    QProcess::execute("/path/to/my/script/script.sh", arguments);
}
Thanks for this, but how do I put the input from those select boxes as arguments?

And in which part of my project I should put these:
Code:
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(hello()));
Code:
void MainWindow::hello()
{
    QStringList arguments;
    arguments << "Enable custom transitions" << "Droid Sans" << "Black";
    QProcess::execute("/path/to/my/script/script.sh", arguments);
}
I have these:
Forms:
- mainwindow-ui

Headers.
- mainwindow.h

Sources:
- main.cpp
- mainwindow.cpp
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P

80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE
 

The Following User Says Thank You to d-iivil For This Useful Post: