ROS2: running command inside Qt?

Hi,what do you mean by running inside Qt ? Building an application that uses Qt and ROS2 or opening a ROS2 package inside the Qt Creator IDE ? In the second case I’d say it is easier to open a bash. Then source the ros2_ws and your own workspace. (See also Trouble opening package in qtcreator)
and then start qtcreator in this terminal.

In the first case you have to adjust your CMakeLists.txt (For example like that: https://github.com/firesurfer/ros2_components/blob/master/CMakeLists.txt)

The relevant lines are:
find_package(Qt5Core REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Widgets REQUIRED)

and
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

And in the CMakeLists that acutally adds targets ( https://github.com/firesurfer/ros2_components/blob/master/src/ros2_components/CMakeLists.txt)

include_directories(
${Qt5Core_INCLUDE_DIRS}
${Qt5Network_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}

)

and

target_link_libraries(
Qt5::Core
Qt5::Network
Qt5::Widgets

)