I'm making a C++ GUI program in Qt using qtcreator its not complete yet but when ever I build and run to test the program it runs then if i click buttons that open a file or write something in a file, the button does that and then the program freezes. Why this happens, What I'm doing wrong or what's the issue.
It mainly freezes in theses two functions:
void MainWindow::on_kmpOpenButton_clicked()
{
QString kmplayerloc = "\"F:\\Program Files\\The KMPlayer\\KMPlayer.exe\"";
QProcess::execute(kmplayerloc);
}
void MainWindow::on_nbopenbutton_clicked()
{
// Remember tha if you have to insert " in a string \"....location of file or anything u want to put.......\"
QString netbeansloc = "\"F:\\Program Files\\NetBeans 7.4\\bin\\netbeans.exe\"";
QProcess::execute(netbeansloc);
}
From the documentation
Starts the program program [..] in a new process, waits for it to finish , and then returns the exit code of the process.
The calling thread freezes until the external process is finished. If you don't want this, use the method start
or startDetached
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.