How can I create a process in C++ or Qt?
-
hello people a need your help, can be with qt or c++, i want to create a process BUT a process that use a function of my program not an external program, something like this .... sorry for the example and forgive my english thanks
void count(){
bbla
bla
bla
}int main(){
QProcess p = new QProcess(count());
p.start();
} -
Hi
When you select New Project, you can select Qt Console Application.
THen you get a non gui app.
You will have to read the parameters in your app and respond to them.also
QProcess(count());is never going to happen. Syntax is not valid.
you must use the normal way of passing parameters.
like
QStringList arguments; arguments << "-style" << "motif"; QProcess *myProcess = new QProcess(this); myProcess->start(program, arguments);
-
yes i know about the sintax that was an example to ilustrate it
-
in your main.cpp
QApplication qApp; qApp.setQuitOnLastWindowClosed(false);
and your app wont terminate when you close the window.
-
@logancale2015
Hi
if Qt console app then it will run until quit() is called.
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec(); // stays here
} -
Hi,
This looks like it could be a job for QtConcurrent::run.