ROS2: running command inside Qt?

My question is still. Do you mean qt or qtcreator? Thats a huge difference. In qtcreator (the ide) there is somewhere at the project tab the possibilty to set a custom build / run environment.

Doing a systemcall for sourcing doesn’t make any sense. But running a qt application together with ros2 without sourcing before is also possible.
The script doesn’t do anything else than setting some environment variables.
You could set the variables by hand using: https://stackoverflow.com/questions/899517/set-local-environment-variables-in-c

Edit: See https://stackoverflow.com/questions/11272720/how-to-run-source-command-in-c why running source via a systemcall doesnt work and also doesn’t make sense.