C++ QT QFileDialog does not close when using system() in triggered action -


void obj_loader::on_actionopen_triggered() { qstring filename = qfiledialog::getopenfilename(this, tr("open file")); if (!filename.isempty()) {     filepath=filename.toutf8().constdata();      command.append(filepath);     int tempnumone=command.size();     (int a=0;a<=tempnumone;a++) { //get letters char list can used system();                 cmd[a]=command[a];     }     openfile=true;      if (openfile) {         openfile=false;         system(cmd);     } }  } 

when system(cmd); called qfiledialog window not close till system command finishes. know if can close search window after clicking open.

the system function blocks event loop: user interaction requires event loop run, , runs when code isn't running. since system invocation in code, can't have block process. need use qprocess has asynchronous interface. this answer provides complete example of 1 process calling -- done single executable.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -