Reputation: 441
I'm in the process of trying to figure out how to launch a windows application in Qt. What I'm trying to accomplish is for the user to click on a button and the notepad windows application opens. I understand that their is a notepad feature in Qt, but I looking for a different way to do this. I want to possible be able to do this with any windows application. Does anyone have any hint on how I can accomplish this?
Upvotes: 2
Views: 5233
Reputation: 18504
Qt
has special class QProcess
which allows you to do this.
For example:
void MainWindow::on_pushButton_clicked()
{
QProcess *proc = new QProcess(this);
proc->start("notepad.exe");
}
There are many useful methods in this class. Check it in the documentation:
http://qt-project.org/doc/qt-5/QProcess.html
Also you can open file in this app. Just use:
proc->start("notepad.exe path");
where path
is something like this: G:/test.txt
To use this class you should #include <QProcess>
Upvotes: 5
Reputation: 7034
You can use QProcess class, look at start or startDetached, example:
QProcess::startDetached("notepad.exe");
Upvotes: 3