Somewhere that gives it a lifetime longer than the function. Either a member variable of the class or allocate the QProcess object on the heap remembering to arrange deletion at the appropriate time.