Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt6 compat #1813

Merged
merged 10 commits into from
Feb 2, 2024
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ find_package(OpenGL REQUIRED)

set(CMAKE_AUTOMOC ON)

find_package(Qt5 REQUIRED COMPONENTS Core Widgets OpenGL)
set(QT_LIBRARIES Qt5::Widgets)
set(QTVERSION ${Qt5Widgets_VERSION})
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
# in theory: find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
simonschmeisser marked this conversation as resolved.
Show resolved Hide resolved
message(STATUS "Found Qt ${Qt${QT_VERSION_MAJOR}_VERSION}")
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets OpenGL)
set(QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Widgets)
set(QTVERSION ${Qt${QT_VERSION_MAJOR}Widgets_VERSION})
add_definitions(-DQT_NO_KEYWORDS)

find_package(catkin REQUIRED
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ add_subdirectory(image_view)
if (CATKIN_ENABLE_TESTING)
add_subdirectory(test)
endif()
add_subdirectory(python_bindings)
if (QT_VERSION_MAJOR EQUAL 5)
add_subdirectory(python_bindings)
endif()
rhaschke marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 3 additions & 4 deletions src/rviz/default_plugin/depth_cloud_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <QObject>
#include <QRegularExpression>

#include "depth_cloud_display.h"
#include <rviz/visualization_manager.h>
Expand Down Expand Up @@ -78,8 +79,7 @@ DepthCloudDisplay::DepthCloudDisplay()

{
// Depth map properties
QRegExp depth_filter("depth");
depth_filter.setCaseSensitivity(Qt::CaseInsensitive);
QRegularExpression depth_filter("depth", QRegularExpression::CaseInsensitiveOption);

topic_filter_property_ =
new Property("Topic Filter", true,
Expand All @@ -100,8 +100,7 @@ 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", QRegularExpression::CaseInsensitiveOption);

color_topic_property_ = new RosFilteredTopicProperty(
"Color Image Topic", "",
Expand Down
11 changes: 6 additions & 5 deletions src/rviz/default_plugin/depth_cloud_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#endif

#include <QMap>
#include <QtCore/QRegularExpression>

using namespace message_filters::sync_policies;

Expand Down Expand Up @@ -81,7 +82,7 @@ class RosFilteredTopicProperty : public RosTopicProperty
const QString& default_value = QString(),
const QString& message_type = QString(),
const QString& description = QString(),
const QRegExp& filter = QRegExp(),
const QRegularExpression& filter = QRegularExpression(),
Property* parent = nullptr)
: RosTopicProperty(name, default_value, message_type, description, parent)
, filter_(filter)
Expand All @@ -94,7 +95,7 @@ class RosFilteredTopicProperty : public RosTopicProperty
const QString& default_value,
const QString& message_type,
const QString& description,
const QRegExp& filter,
const QRegularExpression& filter,
Property* parent,
Func&& changed_slot,
const R* receiver)
Expand All @@ -109,7 +110,7 @@ class RosFilteredTopicProperty : public RosTopicProperty
const QString& default_value,
const QString& message_type,
const QString& description,
const QRegExp& filter,
const QRegularExpression& filter,
P* parent,
Func&& changed_slot)
: RosFilteredTopicProperty(name, default_value, message_type, description, filter, parent)
Expand All @@ -124,7 +125,7 @@ class RosFilteredTopicProperty : public RosTopicProperty
fillTopicList();
}

QRegExp filter() const
QRegularExpression filter() const
{
return filter_;
}
Expand All @@ -142,7 +143,7 @@ protected Q_SLOTS:
}

private:
QRegExp filter_;
QRegularExpression filter_;
bool filter_enabled_;
};

Expand Down
1 change: 1 addition & 0 deletions src/rviz/properties/property_tree_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <stdio.h>

#include <QIODevice>
#include <QStringList>
#include <QMimeData>

Expand Down
4 changes: 2 additions & 2 deletions src/rviz/tool_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/

#include <QKeyEvent>
#include <QRegExp>
#include <QRegularExpression>

#include <ros/assert.h>

Expand All @@ -42,7 +42,7 @@ namespace rviz
{
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();
}
Expand Down
5 changes: 5 additions & 0 deletions src/rviz/viewport_mouse_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ class ViewportMouseEvent
: panel(p)
, viewport(vp)
, type(e->type())
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
rhaschke marked this conversation as resolved.
Show resolved Hide resolved
, x(e->position().x())
, y(e->position().y())
#else
, x(e->x())
, y(e->y())
#endif
, wheel_delta(0)
, acting_button(e->button())
, buttons_down(e->buttons())
Expand Down
3 changes: 2 additions & 1 deletion src/rviz/visualization_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <memory>

#include <QAction>
#include <QActionGroup>
#include <QShortcut>
#include <QApplication>
#include <QCoreApplication>
Expand Down Expand Up @@ -274,7 +275,7 @@ void VisualizationFrame::initialize(const QString& display_config_file)
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);

Expand Down
Loading