diff --git a/rviz2/CMakeLists.txt b/rviz2/CMakeLists.txt index a0677c212..d8baae967 100644 --- a/rviz2/CMakeLists.txt +++ b/rviz2/CMakeLists.txt @@ -18,24 +18,25 @@ find_package(rviz_common REQUIRED) find_package(rviz_ogre_vendor REQUIRED) -find_package(Qt5 REQUIRED COMPONENTS Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) # TODO(wjwwood): this block is to setup the windeployqt tool, could be removed later. -if(Qt5_FOUND AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt) - get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION) +if(Qt${QT_VERSION_MAJOR}_FOUND AND WIN32 AND TARGET Qt${QT_VERSION_MAJOR}::qmake AND NOT TARGET Qt${QT_VERSION_MAJOR}::windeployqt) + get_target_property(_qt_qmake_location Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) execute_process( - COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX + COMMAND "${_qt_qmake_location}" -query QT_INSTALL_PREFIX RESULT_VARIABLE return_code - OUTPUT_VARIABLE qt5_install_prefix + OUTPUT_VARIABLE qt_install_prefix OUTPUT_STRIP_TRAILING_WHITESPACE ) - set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe") + set(imported_location "${qt_install_prefix}/bin/windeployqt.exe") if(EXISTS ${imported_location}) - add_executable(Qt5::windeployqt IMPORTED) + add_executable(Qt${QT_VERSION_MAJOR}::windeployqt IMPORTED) - set_target_properties(Qt5::windeployqt PROPERTIES + set_target_properties(Qt${QT_VERSION_MAJOR}::windeployqt PROPERTIES IMPORTED_LOCATION ${imported_location} ) endif() @@ -48,21 +49,21 @@ target_link_libraries(${PROJECT_NAME} rviz_common::rviz_common rviz_ogre_vendor::OgreMain rviz_ogre_vendor::OgreOverlay - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ) # TODO(wjwwood): find a way to make this optional or to run without "deploying" the # necessary dlls and stuff to the bin folder. # see: # https://stackoverflow.com/questions/41193584/deploy-all-qt-dependencies-when-building#41199492 -if(TARGET Qt5::windeployqt) +if(TARGET Qt${QT_VERSION_MAJOR}::windeployqt) # execute windeployqt in a tmp directory after build add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" - COMMAND set PATH=%PATH%$${qt5_install_prefix}/bin + COMMAND set PATH=%PATH%$${qt_install_prefix}/bin COMMAND - Qt5::windeployqt + Qt${QT_VERSION_MAJOR}::windeployqt --dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" "$/$" ) diff --git a/rviz_common/CMakeLists.txt b/rviz_common/CMakeLists.txt index 3ec7063fb..75624dc85 100644 --- a/rviz_common/CMakeLists.txt +++ b/rviz_common/CMakeLists.txt @@ -31,7 +31,8 @@ find_package(ament_cmake REQUIRED) # do find_package(rviz_ogre_vendor) first to make sure the custom OGRE is found find_package(rviz_ogre_vendor REQUIRED) -find_package(Qt5 REQUIRED COMPONENTS Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(geometry_msgs REQUIRED) find_package(pluginlib REQUIRED) @@ -131,7 +132,7 @@ set(rviz_common_headers_to_moc ) foreach(header "${rviz_common_headers_to_moc}") - qt5_wrap_cpp(rviz_common_moc_files "${header}") + qt_wrap_cpp(rviz_common_moc_files "${header}") endforeach() set(rviz_common_source_files @@ -239,7 +240,7 @@ target_link_libraries(rviz_common PUBLIC ${geometry_msgs_TARGETS} message_filters::message_filters pluginlib::pluginlib - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rclcpp::rclcpp rviz_ogre_vendor::OgreMain rviz_ogre_vendor::OgreOverlay @@ -265,7 +266,7 @@ ament_export_dependencies( geometry_msgs message_filters pluginlib - Qt5 + Qt${QT_VERSION_MAJOR} rclcpp rviz_ogre_vendor rviz_rendering @@ -324,10 +325,10 @@ if(BUILD_TESTING) find_package(ament_cmake_gmock REQUIRED) find_package(ament_cmake_gtest REQUIRED) - qt5_wrap_cpp(rviz_common_test_moc_files test/mock_display.hpp) - qt5_wrap_cpp(rviz_common_test_moc_files test/mock_property_change_receiver.hpp) + qt_wrap_cpp(rviz_common_test_moc_files test/mock_display.hpp) + qt_wrap_cpp(rviz_common_test_moc_files test/mock_property_change_receiver.hpp) - qt5_wrap_cpp(rviz_common_test_frame_manager_moc src/rviz_common/frame_manager.hpp) + qt_wrap_cpp(rviz_common_test_frame_manager_moc src/rviz_common/frame_manager.hpp) ament_add_gmock(display_factory_test test/display_factory_test.cpp @@ -336,7 +337,7 @@ if(BUILD_TESTING) if(TARGET display_factory_test) target_compile_definitions(display_factory_test PUBLIC -D_TEST_PLUGIN_DESCRIPTIONS="${CMAKE_CURRENT_SOURCE_DIR}") - target_link_libraries(display_factory_test rviz_common Qt5::Widgets) + target_link_libraries(display_factory_test rviz_common Qt${QT_VERSION_MAJOR}::Widgets) endif() ament_add_gmock(frame_manager_test @@ -445,7 +446,7 @@ if(BUILD_TESTING) test/mock_property_change_receiver.cpp ${SKIP_DISPLAY_TESTS}) if(TARGET rviz_common_display_test) - target_link_libraries(rviz_common_display_test rviz_common Qt5::Widgets yaml-cpp::yaml-cpp) + target_link_libraries(rviz_common_display_test rviz_common Qt${QT_VERSION_MAJOR}::Widgets yaml-cpp::yaml-cpp) endif() endif() diff --git a/rviz_common/include/rviz_common/properties/ros_topic_property.hpp b/rviz_common/include/rviz_common/properties/ros_topic_property.hpp index c55303e6d..e98b2e21c 100644 --- a/rviz_common/include/rviz_common/properties/ros_topic_property.hpp +++ b/rviz_common/include/rviz_common/properties/ros_topic_property.hpp @@ -31,6 +31,8 @@ #include +#include // NOLINT: cpplint is unable to handle the include order here + #include "rviz_common/properties/editable_enum_property.hpp" #include "rviz_common/ros_integration/ros_node_abstraction_iface.hpp" #include "rviz_common/visibility_control.hpp" @@ -89,20 +91,20 @@ class RVIZ_COMMON_PUBLIC RosFilteredTopicProperty const QString & default_value = QString(), const QString & message_type = QString(), const QString & description = QString(), - const QRegExp & filter = QRegExp(), + const QRegularExpression & filter = QRegularExpression(), Property * parent = 0, const char * changed_slot = 0, QObject * receiver = 0); void enableFilter(bool enabled); - QRegExp filter() const; + QRegularExpression filter() const; protected Q_SLOTS: void fillTopicList() override; private: - QRegExp filter_; + QRegularExpression filter_; bool filter_enabled_; }; diff --git a/rviz_common/rviz_common-extras.cmake b/rviz_common/rviz_common-extras.cmake index 5a719edad..de3aa09a1 100644 --- a/rviz_common/rviz_common-extras.cmake +++ b/rviz_common/rviz_common-extras.cmake @@ -27,4 +27,5 @@ # find package Qt5 because otherwise using the rviz_common::rviz_common # exported target will complain that the Qt5::Widgets target does not exist -find_package(Qt5 REQUIRED QUIET COMPONENTS Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED QUIET COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED QUIET COMPONENTS Widgets) diff --git a/rviz_common/src/rviz_common/add_display_dialog.cpp b/rviz_common/src/rviz_common/add_display_dialog.cpp index 28b56373f..601431447 100644 --- a/rviz_common/src/rviz_common/add_display_dialog.cpp +++ b/rviz_common/src/rviz_common/add_display_dialog.cpp @@ -46,6 +46,7 @@ #include // NOLINT: cpplint is unable to handle the include order here #include // NOLINT: cpplint is unable to handle the include order here #include // NOLINT: cpplint is unable to handle the include order here +#include // NOLINT: cpplint is unable to handle the include order here #include // NOLINT: cpplint is unable to handle the include order here #include // NOLINT: cpplint is unable to handle the include order here #include // NOLINT: cpplint is unable to handle the include order here @@ -590,7 +591,7 @@ void TopicDisplayWidget::findPlugins(DisplayFactory * factory) // For now, we assume that all types supported by plugins have the form // "/msg/", though in the future zero or more namespaces may be // permitted. - QRegExp delim("/"); + QRegularExpression delim("/"); QStringList topic_type_parts = topic_type.split(delim); if (topic_type_parts.size() == 2) { topic_type = topic_type_parts.at(0) + "/msg/" + topic_type_parts.at(1); diff --git a/rviz_common/src/rviz_common/properties/property_tree_model.cpp b/rviz_common/src/rviz_common/properties/property_tree_model.cpp index 2684a8484..7c0980b48 100644 --- a/rviz_common/src/rviz_common/properties/property_tree_model.cpp +++ b/rviz_common/src/rviz_common/properties/property_tree_model.cpp @@ -32,6 +32,7 @@ #include +#include // NOLINT: cpplint is unable to handle the include order here #include // NOLINT: cpplint is unable to handle the include order here #include // NOLINT: cpplint is unable to handle the include order here diff --git a/rviz_common/src/rviz_common/properties/ros_topic_property.cpp b/rviz_common/src/rviz_common/properties/ros_topic_property.cpp index 6a1fab396..a3b56cdc3 100644 --- a/rviz_common/src/rviz_common/properties/ros_topic_property.cpp +++ b/rviz_common/src/rviz_common/properties/ros_topic_property.cpp @@ -94,7 +94,7 @@ RosFilteredTopicProperty::RosFilteredTopicProperty( const QString & default_value, const QString & message_type, const QString & description, - const QRegExp & filter, + const QRegularExpression & filter, Property * parent, const char * changed_slot, QObject * receiver) @@ -110,7 +110,7 @@ void RosFilteredTopicProperty::enableFilter(bool enabled) fillTopicList(); } -QRegExp RosFilteredTopicProperty::filter() const +QRegularExpression RosFilteredTopicProperty::filter() const { return filter_; } diff --git a/rviz_common/src/rviz_common/tool_manager.cpp b/rviz_common/src/rviz_common/tool_manager.cpp index 2443ff57b..d3d5edcfb 100644 --- a/rviz_common/src/rviz_common/tool_manager.cpp +++ b/rviz_common/src/rviz_common/tool_manager.cpp @@ -35,7 +35,7 @@ #include // NOLINT: cpplint is unable to handle the include order here #include // NOLINT: cpplint is unable to handle the include order here -#include // NOLINT: cpplint is unable to handle the include order here +#include // NOLINT: cpplint is unable to handle the include order here #include "rviz_common/logging.hpp" @@ -52,7 +52,7 @@ using rviz_common::properties::PropertyTreeModel; QString addSpaceToCamelCase(QString input) { - QRegExp re = QRegExp("([A-Z])([a-z]*)"); + QRegularExpression re = QRegularExpression("([A-Z])([a-z]*)"); input.replace(re, " \\1\\2"); return input.trimmed(); } diff --git a/rviz_common/src/rviz_common/visualization_frame.cpp b/rviz_common/src/rviz_common/visualization_frame.cpp index c3d55a6b0..e936c9bf1 100644 --- a/rviz_common/src/rviz_common/visualization_frame.cpp +++ b/rviz_common/src/rviz_common/visualization_frame.cpp @@ -42,6 +42,7 @@ #include #include +#include // NOLINT cpplint cannot handle include order here #include // NOLINT cpplint cannot handle include order here #include // NOLINT cpplint cannot handle include order here #include // NOLINT cpplint cannot handle include order here @@ -262,7 +263,7 @@ void VisualizationFrame::initialize( QWidget * central_widget = new QWidget(this); QHBoxLayout * central_layout = new QHBoxLayout; central_layout->setSpacing(0); - central_layout->setMargin(0); + central_layout->setContentsMargins(0, 0, 0, 0); render_panel_ = new RenderPanel(central_widget); diff --git a/rviz_default_plugins/CMakeLists.txt b/rviz_default_plugins/CMakeLists.txt index b845f9d8c..55fed87d0 100644 --- a/rviz_default_plugins/CMakeLists.txt +++ b/rviz_default_plugins/CMakeLists.txt @@ -57,7 +57,8 @@ find_package(rviz_common REQUIRED) find_package(rviz_rendering REQUIRED) find_package(rviz_ogre_vendor REQUIRED) -find_package(Qt5 REQUIRED COMPONENTS Widgets Test) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets) find_package(geometry_msgs REQUIRED) @@ -135,7 +136,7 @@ set(rviz_default_plugins_headers_to_moc ) foreach(header "${rviz_default_plugins_headers_to_moc}") - qt5_wrap_cpp(rviz_default_plugins_moc_files "${header}") + qt_wrap_cpp(rviz_default_plugins_moc_files "${header}") endforeach() set(rviz_default_plugins_source_files @@ -240,7 +241,6 @@ add_library(rviz_default_plugins SHARED target_include_directories(rviz_default_plugins PUBLIC $ $ - ${Qt5Widgets_INCLUDE_DIRS} ) target_link_libraries(rviz_default_plugins PUBLIC @@ -251,6 +251,7 @@ target_link_libraries(rviz_default_plugins PUBLIC ${map_msgs_TARGETS} ${nav_msgs_TARGETS} point_cloud_transport::point_cloud_transport + Qt${QT_VERSION_MAJOR}::Widgets rclcpp::rclcpp rviz_common::rviz_common rviz_ogre_vendor::OgreMain @@ -289,6 +290,7 @@ ament_export_dependencies( map_msgs nav_msgs point_cloud_transport + Qt${QT_VERSION_MAJOR} rclcpp rviz_common rviz_ogre_vendor @@ -365,7 +367,7 @@ if(BUILD_TESTING) target_link_libraries(fps_view_controller_test ${TEST_FIXTURE_WITH_MOCK_LIBRARIES} rviz_default_plugins - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ogre_testing_environment ) endif() @@ -402,7 +404,7 @@ if(BUILD_TESTING) ${SKIP_DISPLAY_TESTS}) if(TARGET image_display_test) target_include_directories(image_display_test PRIVATE test) - target_link_libraries(image_display_test ${TEST_FIXTURE_WITH_MOCK_LIBRARIES} Qt5::Widgets rviz_default_plugins ogre_testing_environment) + target_link_libraries(image_display_test ${TEST_FIXTURE_WITH_MOCK_LIBRARIES} Qt${QT_VERSION_MAJOR}::Widgets rviz_default_plugins ogre_testing_environment) endif() add_library(marker_messages STATIC test/rviz_default_plugins/displays/marker/marker_messages.cpp) @@ -495,7 +497,7 @@ if(BUILD_TESTING) target_include_directories(orbit_view_controller_test PRIVATE test) target_link_libraries(orbit_view_controller_test ${TEST_FIXTURE_WITH_MOCK_LIBRARIES} - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rviz_default_plugins ogre_testing_environment ) @@ -509,7 +511,7 @@ if(BUILD_TESTING) target_include_directories(ortho_view_controller_test PRIVATE test) target_link_libraries(ortho_view_controller_test ${TEST_FIXTURE_WITH_MOCK_LIBRARIES} - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rviz_default_plugins ogre_testing_environment ) @@ -602,7 +604,7 @@ if(BUILD_TESTING) target_include_directories(point_cloud_transformers_test PRIVATE test) target_link_libraries(point_cloud_transformers_test ${TEST_FIXTURE_WITH_MOCK_LIBRARIES} - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rviz_default_plugins pointcloud_messages ogre_testing_environment @@ -659,7 +661,7 @@ if(BUILD_TESTING) target_link_libraries(robot_test ${TEST_FIXTURE_WITH_MOCK_LIBRARIES} resource_retriever::resource_retriever - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rviz_default_plugins ogre_testing_environment ) @@ -696,7 +698,7 @@ if(BUILD_TESTING) target_include_directories(xy_orbit_view_controller_test PRIVATE test) target_link_libraries(xy_orbit_view_controller_test ${TEST_FIXTURE_WITH_MOCK_LIBRARIES} - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rviz_default_plugins ogre_testing_environment ) @@ -773,7 +775,7 @@ if(BUILD_TESTING) endif() add_library(point_cloud_common_page_object STATIC test/rviz_default_plugins/page_objects/point_cloud_common_page_object.cpp) - target_link_libraries(point_cloud_common_page_object PRIVATE Qt5::Test rviz_visual_testing_framework::rviz_visual_testing_framework) + target_link_libraries(point_cloud_common_page_object PRIVATE Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework) ament_add_gtest(camera_display_visual_test test/rviz_default_plugins/displays/camera/camera_display_visual_test.cpp @@ -787,7 +789,7 @@ if(BUILD_TESTING) rclcpp::rclcpp ${sensor_msgs_TARGETS} ${std_msgs_TARGETS} - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test ${geometry_msgs_TARGETS} tf2::tf2 point_cloud_common_page_object @@ -830,7 +832,7 @@ if(BUILD_TESTING) target_include_directories(fluid_pressure_display_visual_test PRIVATE test) target_link_libraries(fluid_pressure_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rclcpp::rclcpp pointcloud_messages point_cloud_common_page_object @@ -845,7 +847,7 @@ if(BUILD_TESTING) if(TARGET grid_display_visual_test) target_include_directories(grid_display_visual_test PRIVATE test) target_link_libraries(grid_display_visual_test - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework ) endif() @@ -870,7 +872,7 @@ if(BUILD_TESTING) if(TARGET illuminance_display_visual_test) target_include_directories(illuminance_display_visual_test PRIVATE test) target_link_libraries(illuminance_display_visual_test - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework pointcloud_messages point_cloud_common_page_object @@ -885,7 +887,7 @@ if(BUILD_TESTING) if(TARGET image_display_visual_test) target_include_directories(image_display_visual_test PRIVATE test) target_link_libraries(image_display_visual_test - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework rclcpp::rclcpp ${sensor_msgs_TARGETS} @@ -901,7 +903,7 @@ if(BUILD_TESTING) target_include_directories(interactive_marker_namespace_property_test PRIVATE test) target_link_libraries(interactive_marker_namespace_property_test rviz_default_plugins - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ogre_testing_environment ) endif() @@ -914,13 +916,13 @@ if(BUILD_TESTING) target_include_directories(laser_scan_display_visual_test PRIVATE test) target_link_libraries(laser_scan_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test point_cloud_common_page_object ) endif() add_library(marker_display_page_object STATIC test/rviz_default_plugins/page_objects/marker_display_page_object.cpp) - target_link_libraries(marker_display_page_object PRIVATE Qt5::Widgets rviz_visual_testing_framework::rviz_visual_testing_framework) + target_link_libraries(marker_display_page_object PRIVATE Qt${QT_VERSION_MAJOR}::Widgets rviz_visual_testing_framework::rviz_visual_testing_framework) ament_add_gtest(map_display_visual_test test/rviz_default_plugins/displays/map/map_display_visual_test.cpp @@ -931,7 +933,7 @@ if(BUILD_TESTING) target_include_directories(map_display_visual_test PRIVATE test) target_link_libraries(map_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rclcpp::rclcpp ${std_msgs_TARGETS} ${geometry_msgs_TARGETS} @@ -950,7 +952,7 @@ if(BUILD_TESTING) target_include_directories(marker_array_display_visual_test PRIVATE test) target_link_libraries(marker_array_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rclcpp::rclcpp ${std_msgs_TARGETS} ${visualization_msgs_TARGETS} @@ -966,7 +968,7 @@ if(BUILD_TESTING) target_include_directories(marker_display_visual_test PRIVATE test) target_link_libraries(marker_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rclcpp::rclcpp ${std_msgs_TARGETS} ${visualization_msgs_TARGETS} @@ -983,7 +985,7 @@ if(BUILD_TESTING) target_include_directories(odometry_display_visual_test PRIVATE test) target_link_libraries(odometry_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rclcpp::rclcpp ${std_msgs_TARGETS} ${geometry_msgs_TARGETS} @@ -1000,7 +1002,7 @@ if(BUILD_TESTING) if(TARGET path_display_visual_test) target_include_directories(path_display_visual_test PRIVATE test) target_link_libraries(path_display_visual_test - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework rclcpp::rclcpp ${std_msgs_TARGETS} @@ -1018,7 +1020,7 @@ if(BUILD_TESTING) target_include_directories(point_display_visual_test PRIVATE test) target_link_libraries(point_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ${geometry_msgs_TARGETS} rclcpp::rclcpp ${std_msgs_TARGETS} @@ -1032,7 +1034,7 @@ if(BUILD_TESTING) if(TARGET point_cloud_display_visual_test) target_include_directories(point_cloud_display_visual_test PRIVATE test) target_link_libraries(point_cloud_display_visual_test - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework ${geometry_msgs_TARGETS} tf2::tf2 @@ -1050,7 +1052,7 @@ if(BUILD_TESTING) if(TARGET point_cloud2_display_visual_test) target_include_directories(point_cloud2_display_visual_test PRIVATE test) target_link_libraries(point_cloud2_display_visual_test - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework pointcloud_messages point_cloud_common_page_object @@ -1058,7 +1060,7 @@ if(BUILD_TESTING) endif() add_library(pose_display_page_object STATIC test/rviz_default_plugins/page_objects/pose_display_page_object.cpp) - target_link_libraries(pose_display_page_object PRIVATE Qt5::Widgets rviz_visual_testing_framework::rviz_visual_testing_framework) + target_link_libraries(pose_display_page_object PRIVATE Qt${QT_VERSION_MAJOR}::Widgets rviz_visual_testing_framework::rviz_visual_testing_framework) ament_add_gtest(pose_array_display_visual_test test/rviz_default_plugins/displays/pose_array/pose_array_display_visual_test.cpp @@ -1069,7 +1071,7 @@ if(BUILD_TESTING) target_include_directories(pose_array_display_visual_test PRIVATE test) target_link_libraries(pose_array_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rclcpp::rclcpp ${std_msgs_TARGETS} ${geometry_msgs_TARGETS} @@ -1085,7 +1087,7 @@ if(BUILD_TESTING) target_include_directories(pose_display_visual_test PRIVATE test) target_link_libraries(pose_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ${geometry_msgs_TARGETS} rclcpp::rclcpp ${std_msgs_TARGETS} @@ -1102,7 +1104,7 @@ if(BUILD_TESTING) target_include_directories(pose_with_covariance_display_visual_test PRIVATE test) target_link_libraries(pose_with_covariance_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ${geometry_msgs_TARGETS} rclcpp::rclcpp ${std_msgs_TARGETS} @@ -1119,7 +1121,7 @@ if(BUILD_TESTING) target_include_directories(range_display_visual_test PRIVATE test) target_link_libraries(range_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ) endif() @@ -1130,7 +1132,7 @@ if(BUILD_TESTING) if(TARGET relative_humidity_display_visual_test) target_include_directories(relative_humidity_display_visual_test PRIVATE test) target_link_libraries(relative_humidity_display_visual_test - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework point_cloud_common_page_object ) @@ -1156,7 +1158,7 @@ if(BUILD_TESTING) if(TARGET temperature_display_visual_test) target_include_directories(temperature_display_visual_test PRIVATE test) target_link_libraries(temperature_display_visual_test - Qt5::Test + Qt${QT_VERSION_MAJOR}::Test rviz_visual_testing_framework::rviz_visual_testing_framework point_cloud_common_page_object ) @@ -1171,7 +1173,7 @@ if(BUILD_TESTING) target_include_directories(tf_display_visual_test PRIVATE test) target_link_libraries(tf_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ) endif() @@ -1199,7 +1201,7 @@ if(BUILD_TESTING) target_include_directories(wrench_display_visual_test PRIVATE test) target_link_libraries(wrench_display_visual_test rviz_visual_testing_framework::rviz_visual_testing_framework - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ) endif() endif() diff --git a/rviz_default_plugins/rviz_default_plugins-extras.cmake b/rviz_default_plugins/rviz_default_plugins-extras.cmake index c3c890085..6dad73069 100644 --- a/rviz_default_plugins/rviz_default_plugins-extras.cmake +++ b/rviz_default_plugins/rviz_default_plugins-extras.cmake @@ -27,4 +27,5 @@ # find package Qt5 because otherwise using the rviz_default_plugins::rviz_default_plugins # exported target will complain that the Qt5::Widgets target does not exist -find_package(Qt5 REQUIRED QUIET COMPONENTS Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED QUIET COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED QUIET COMPONENTS Widgets) diff --git a/rviz_default_plugins/src/rviz_default_plugins/displays/depth_cloud/depth_cloud_display.cpp b/rviz_default_plugins/src/rviz_default_plugins/displays/depth_cloud/depth_cloud_display.cpp index 5a3c159dc..dfd04f4b4 100644 --- a/rviz_default_plugins/src/rviz_default_plugins/displays/depth_cloud/depth_cloud_display.cpp +++ b/rviz_default_plugins/src/rviz_default_plugins/displays/depth_cloud/depth_cloud_display.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include @@ -81,8 +81,8 @@ DepthCloudDisplay::DepthCloudDisplay() { ml_depth_data_ = std::make_unique(); // Depth map properties - QRegExp depth_filter("depth"); - depth_filter.setCaseSensitivity(Qt::CaseInsensitive); + QRegularExpression depth_filter("depth"); + depth_filter.setPatternOptions(QRegularExpression::CaseInsensitiveOption); reliability_policy_property_ = new rviz_common::properties::EditableEnumProperty( "Reliability Policy", @@ -119,8 +119,8 @@ DepthCloudDisplay::DepthCloudDisplay() depth_transport_property_->setStdString("raw"); // color image properties - QRegExp color_filter("color|rgb|bgr|gray|mono"); - color_filter.setCaseSensitivity(Qt::CaseInsensitive); + QRegularExpression color_filter("color|rgb|bgr|gray|mono"); + color_filter.setPatternOptions(QRegularExpression::CaseInsensitiveOption); color_topic_property_ = new rviz_common::properties::RosFilteredTopicProperty( "Color Image Topic", "", diff --git a/rviz_rendering/CMakeLists.txt b/rviz_rendering/CMakeLists.txt index fee1258b8..b58fd1031 100644 --- a/rviz_rendering/CMakeLists.txt +++ b/rviz_rendering/CMakeLists.txt @@ -33,7 +33,8 @@ find_package(ament_cmake_ros REQUIRED) find_package(rviz_ogre_vendor REQUIRED) find_package(rviz_assimp_vendor REQUIRED) -find_package(Qt5 REQUIRED COMPONENTS Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(ament_index_cpp REQUIRED) find_package(eigen3_cmake_module REQUIRED) @@ -41,29 +42,29 @@ find_package(Eigen3 REQUIRED) find_package(resource_retriever REQUIRED) # TODO(wjwwood): this block is to setup the windeployqt tool, could be removed later. -if(Qt5_FOUND AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt) - get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION) +if(Qt${QT_VERSION_MAJOR}_FOUND AND WIN32 AND TARGET Qt${QT_VERSION_MAJOR}::qmake AND NOT TARGET Qt${QT_VERSION_MAJOR}::windeployqt) + get_target_property(_qt_qmake_location Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) execute_process( - COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX + COMMAND "${_qt_qmake_location}" -query Qt${QT_VERSION_MAJOR}_INSTALL_PREFIX RESULT_VARIABLE return_code - OUTPUT_VARIABLE qt5_install_prefix + OUTPUT_VARIABLE qt_install_prefix OUTPUT_STRIP_TRAILING_WHITESPACE ) - set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe") + set(imported_location "${qt_install_prefix}/bin/windeployqt.exe") if(EXISTS ${imported_location}) - add_executable(Qt5::windeployqt IMPORTED) + add_executable(Qt${QT_VERSION_MAJOR}::windeployqt IMPORTED) - set_target_properties(Qt5::windeployqt PROPERTIES + set_target_properties(Qt${QT_VERSION_MAJOR}::windeployqt PROPERTIES IMPORTED_LOCATION ${imported_location} ) endif() endif() # These need to be added in the add_library() call -qt5_wrap_cpp(rviz_rendering_moc_files include/rviz_rendering/render_window.hpp) +qt_wrap_cpp(rviz_rendering_moc_files include/rviz_rendering/render_window.hpp) add_library(rviz_rendering SHARED ${rviz_rendering_moc_files} @@ -100,7 +101,7 @@ add_library(rviz_rendering SHARED ) target_link_libraries(rviz_rendering PUBLIC - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets rviz_ogre_vendor::OgreMain rviz_ogre_vendor::OgreOverlay ) @@ -128,7 +129,7 @@ target_compile_definitions(rviz_rendering PRIVATE "RVIZ_RENDERING_BUILDING_LIBRA ament_export_dependencies( Eigen3 - Qt5 + Qt${QT_VERSION_MAJOR} rviz_ogre_vendor ) @@ -194,7 +195,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -206,7 +207,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -218,7 +219,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -230,7 +231,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -242,7 +243,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -254,7 +255,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -267,7 +268,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreOverlay rviz_rendering rviz_rendering_test_utils - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets ) endif() @@ -279,7 +280,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -291,7 +292,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -303,7 +304,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -315,7 +316,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() @@ -327,7 +328,7 @@ if(BUILD_TESTING) rviz_ogre_vendor::OgreMain rviz_rendering rviz_rendering_test_utils - Qt5::Widgets # explicitly do this for include directories (not necessary for external use) + Qt${QT_VERSION_MAJOR}::Widgets # explicitly do this for include directories (not necessary for external use) ) endif() endif() diff --git a/rviz_rendering/rviz_rendering-extras.cmake b/rviz_rendering/rviz_rendering-extras.cmake index 936845819..997c445ba 100644 --- a/rviz_rendering/rviz_rendering-extras.cmake +++ b/rviz_rendering/rviz_rendering-extras.cmake @@ -27,4 +27,5 @@ # find package Qt5 because otherwise using the rviz_rendering::rviz_rendering # exported target will complain that the Qt5::Widgets target does not exist -find_package(Qt5 REQUIRED QUIET COMPONENTS Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED QUIET COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED QUIET COMPONENTS Widgets) diff --git a/rviz_rendering_tests/CMakeLists.txt b/rviz_rendering_tests/CMakeLists.txt index 3b593ddc6..ddaaad439 100644 --- a/rviz_rendering_tests/CMakeLists.txt +++ b/rviz_rendering_tests/CMakeLists.txt @@ -32,7 +32,8 @@ find_package(ament_cmake REQUIRED) if(BUILD_TESTING) # do find_package(rviz_ogre_vendor) first to make sure the custom OGRE is found find_package(rviz_ogre_vendor REQUIRED) - find_package(Qt5 REQUIRED COMPONENTS Widgets) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(rviz_rendering REQUIRED) find_package(resource_retriever REQUIRED) diff --git a/rviz_visual_testing_framework/CMakeLists.txt b/rviz_visual_testing_framework/CMakeLists.txt index f393ec727..b4c8156f0 100644 --- a/rviz_visual_testing_framework/CMakeLists.txt +++ b/rviz_visual_testing_framework/CMakeLists.txt @@ -25,7 +25,8 @@ endif() find_package(ament_cmake REQUIRED) find_package(geometry_msgs REQUIRED) -find_package(Qt5 REQUIRED COMPONENTS Widgets Test) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets) find_package(rclcpp REQUIRED) find_package(rcutils REQUIRED) find_package(rviz_common REQUIRED) @@ -39,13 +40,13 @@ find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() # TODO(wjwwood): this block is to setup the windeployqt tool, could be removed later. -if(Qt5_FOUND AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt) - get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION) +if(Qt${QT_VERSION_MAJOR}_FOUND AND WIN32 AND TARGET Qt${QT_VERSION_MAJOR}::qmake AND NOT TARGET Qt${QT_VERSION_MAJOR}::windeployqt) + get_target_property(_qt_qmake_location Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) execute_process( - COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX + COMMAND "${_qt_qmake_location}" -query QT_INSTALL_PREFIX RESULT_VARIABLE return_code - OUTPUT_VARIABLE qt5_install_prefix + OUTPUT_VARIABLE qt_install_prefix OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() @@ -71,8 +72,8 @@ target_include_directories(rviz_visual_testing_framework target_link_libraries(rviz_visual_testing_framework PUBLIC ${geometry_msgs_TARGETS} - Qt5::Test - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Test + Qt${QT_VERSION_MAJOR}::Widgets rclcpp::rclcpp rcutils::rcutils rviz_common::rviz_common @@ -84,7 +85,7 @@ target_link_libraries(rviz_visual_testing_framework PUBLIC ) # export information to downstream packages -ament_export_dependencies(geometry_msgs Qt5 rclcpp rcutils rviz_common rviz_ogre_vendor rviz_rendering std_msgs tf2 tf2_ros) +ament_export_dependencies(geometry_msgs Qt${QT_VERSION_MAJOR} rclcpp rcutils rviz_common rviz_ogre_vendor rviz_rendering std_msgs tf2 tf2_ros) # Export old-style CMake variables ament_export_include_directories("include/${PROJECT_NAME}")