Suppose I need to start any program which is there available in my computer by click of button from my designed form.
I have created a QDialog and put a pushbutton. Then through a private slot I am trying to access the program ( or launch the program , say windows media player which is “wmplayer†) which ideally should be detached from the parent program which I launch initially .
I have tried QProcess with various combinations but it is not working.
Where as if you type wmplayer on the command line run window the program runs.
Interestingly when I type “cmd†that is the command line window it runs from myprogram and the command prompt for DOS opens up .But this is theonlyone which runs.
The code is as
{
ui.setupUi(this);
connect(ui.showdatafile, SIGNAL(clicked()), this, SLOT(showdatafile()));
}
void steg::showdatafile()
{
myProcess->startDetached(program);
}
steg::steg(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
connect(ui.showdatafile, SIGNAL(clicked()), this, SLOT(showdatafile()));
}
void steg::showdatafile()
{
QProcess *myProcess ;
QString program = "wmplayer";
myProcess->startDetached(program);
}
To copy to clipboard, switch view to plain text mode
I have tried your suggestion also
QProcess::startDetached( "start", QStringList() << "something.jpg" );
To copy to clipboard, switch view to plain text mode
the code doesnot give any error.But when I click the button to launch it just doesnot run at all
could you suggest some solution
Bookmarks