diff --git a/.gitignore b/.gitignore
index a454f9d..f37bf90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+log
+install
# ---> C++
# Prerequisites
*.d
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10df7f8..67db5e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.8)
+cmake_minimum_required(VERSION 3.10)
project(rqt_demo_plugin)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -16,10 +16,12 @@ find_package(Qt5 COMPONENTS Core REQUIRED)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5 COMPONENTS Qml REQUIRED)
find_package(Qt5 COMPONENTS Quick REQUIRED)
+find_package(Qt5QuickCompiler)
set(CMAKE_AUTOMOC ON)
+set(QT_QML_GENERATE_QMLLS_INI ON)
qt_wrap_cpp(MOC_FILES include/rqt_demo_plugin/rqt_demo_plugin.hpp)
-qt5_add_resources(RCC_SOURCES "resources/res.qrc")
+qtquick_compiler_add_resources(RCC_SOURCES "resources/res.qrc")
add_library(
diff --git a/include/rqt_demo_plugin/rqt_demo_plugin.hpp b/include/rqt_demo_plugin/rqt_demo_plugin.hpp
index ccca2df..414732c 100644
--- a/include/rqt_demo_plugin/rqt_demo_plugin.hpp
+++ b/include/rqt_demo_plugin/rqt_demo_plugin.hpp
@@ -21,21 +21,19 @@ class DemoPluginMg : public rqt_gui_cpp::Plugin {
Q_OBJECT
public:
DemoPluginMg();
- ~DemoPluginMg();
virtual void shutdownPlugin() {
- RCLCPP_INFO(node_->get_logger(), "The plugin has been shutdown");
+ cleanupResources();
}
virtual void initPlugin(qt_gui_cpp::PluginContext &);
};
inline void DemoPluginMg::initPlugin(qt_gui_cpp::PluginContext &pc) {
+ initResources();
QQuickView *qv = new QQuickView(QUrl("qrc:/qml/helloworld.qml"));
qv->setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
- QWidget *qw = QWidget::createWindowContainer(qv);
- pc.addWidget(qw);
-
- RCLCPP_INFO(node_->get_logger(), "The plugin has been initialized");
+ QWidget *qw_ = QWidget::createWindowContainer(qv);
+ pc.addWidget(qw_);
}
}; // namespace mg
diff --git a/log/latest_build b/log/latest_build
index 9b4afb4..f95b3bf 120000
--- a/log/latest_build
+++ b/log/latest_build
@@ -1 +1 @@
-build_2025-03-07_23-29-50
\ No newline at end of file
+build_2025-03-08_17-19-32
\ No newline at end of file
diff --git a/package.xml b/package.xml
index cb5d9a3..2049575 100644
--- a/package.xml
+++ b/package.xml
@@ -13,7 +13,7 @@
pluginlib
rqt
rqt_gui_cpp
-
+ rqt_image_view
ament_cmake
diff --git a/resources/qml/helloworld.qml b/resources/qml/helloworld.qml
index 096fb46..c577f72 100644
--- a/resources/qml/helloworld.qml
+++ b/resources/qml/helloworld.qml
@@ -1,22 +1,48 @@
import QtQuick 2.3
-Item {
- Row {
- anchors.right: parent.right
- spacing: 4
+
+Rectangle {
+ color: "gray"
+ Flickable {
+ width: parent.width;
+ height: parent.height
+ contentWidth: 2500; contentHeight: 1500
+ flickDeceleration: 10000
+ leftMargin: Math.max((width - contentWidth)/2,0)
+ topMargin: Math.max((height - contentHeight)/2,0)
+ clip: true
+
Rectangle {
- height: 100
- width: 100
- color: "green"
- Text {
- text: "Hello, World!"
- }
- }
- Rectangle {
- height: 100
- width: 100
- color: "red"
- Text {
- text: "Hello, World!"
+ color: "white"
+ id: contentRect
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: parent.width
+ height: parent.height
+
+ transform: Scale {yScale: 1; xScale: 1}
+ transformOrigin: Item.TopLeft
+
+ Row {
+ x:0
+ y:0
+ spacing: 4
+
+ Rectangle {
+ height: 100
+ width: 100
+ color: "green"
+ Text {
+ text: "Hello, World!"
+ }
+ }
+ Rectangle {
+ height: 100
+ width: 100
+ color: "red"
+ Text {
+ text: "Hello, World!"
+ }
+ }
}
}
}
diff --git a/src/rqt_demo_plugin.cpp b/src/rqt_demo_plugin.cpp
index 3bedeb1..b9a92e6 100644
--- a/src/rqt_demo_plugin.cpp
+++ b/src/rqt_demo_plugin.cpp
@@ -6,10 +6,8 @@
PLUGINLIB_EXPORT_CLASS(mg::DemoPluginMg, rqt_gui_cpp::Plugin)
mg::DemoPluginMg::DemoPluginMg() : Plugin() {
- initResources();
QSurfaceFormat fmt;
fmt.setSwapInterval(0);
fmt.setRenderableType(QSurfaceFormat::OpenGLES);
QSurfaceFormat::setDefaultFormat(fmt);
-}
-mg::DemoPluginMg::~DemoPluginMg() { cleanupResources(); }
\ No newline at end of file
+}
\ No newline at end of file