Set qml to be precompiled
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
log
|
||||||
|
install
|
||||||
# ---> C++
|
# ---> C++
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.8)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(rqt_demo_plugin)
|
project(rqt_demo_plugin)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
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 Widgets REQUIRED)
|
||||||
find_package(Qt5 COMPONENTS Qml REQUIRED)
|
find_package(Qt5 COMPONENTS Qml REQUIRED)
|
||||||
find_package(Qt5 COMPONENTS Quick REQUIRED)
|
find_package(Qt5 COMPONENTS Quick REQUIRED)
|
||||||
|
find_package(Qt5QuickCompiler)
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(QT_QML_GENERATE_QMLLS_INI ON)
|
||||||
qt_wrap_cpp(MOC_FILES include/rqt_demo_plugin/rqt_demo_plugin.hpp)
|
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(
|
add_library(
|
||||||
|
|||||||
@ -21,21 +21,19 @@ class DemoPluginMg : public rqt_gui_cpp::Plugin {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DemoPluginMg();
|
DemoPluginMg();
|
||||||
~DemoPluginMg();
|
|
||||||
|
|
||||||
virtual void shutdownPlugin() {
|
virtual void shutdownPlugin() {
|
||||||
RCLCPP_INFO(node_->get_logger(), "The plugin has been shutdown");
|
cleanupResources();
|
||||||
}
|
}
|
||||||
virtual void initPlugin(qt_gui_cpp::PluginContext &);
|
virtual void initPlugin(qt_gui_cpp::PluginContext &);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void DemoPluginMg::initPlugin(qt_gui_cpp::PluginContext &pc) {
|
inline void DemoPluginMg::initPlugin(qt_gui_cpp::PluginContext &pc) {
|
||||||
|
initResources();
|
||||||
QQuickView *qv = new QQuickView(QUrl("qrc:/qml/helloworld.qml"));
|
QQuickView *qv = new QQuickView(QUrl("qrc:/qml/helloworld.qml"));
|
||||||
qv->setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
|
qv->setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
|
||||||
QWidget *qw = QWidget::createWindowContainer(qv);
|
QWidget *qw_ = QWidget::createWindowContainer(qv);
|
||||||
pc.addWidget(qw);
|
pc.addWidget(qw_);
|
||||||
|
|
||||||
RCLCPP_INFO(node_->get_logger(), "The plugin has been initialized");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace mg
|
}; // namespace mg
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
build_2025-03-07_23-29-50
|
build_2025-03-08_17-19-32
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<depend>pluginlib</depend>
|
<depend>pluginlib</depend>
|
||||||
<depend>rqt</depend>
|
<depend>rqt</depend>
|
||||||
<depend>rqt_gui_cpp</depend>
|
<depend>rqt_gui_cpp</depend>
|
||||||
|
<depend>rqt_image_view</depend>
|
||||||
|
|
||||||
<export>
|
<export>
|
||||||
<build_type>ament_cmake</build_type>
|
<build_type>ament_cmake</build_type>
|
||||||
|
|||||||
@ -1,8 +1,32 @@
|
|||||||
import QtQuick 2.3
|
import QtQuick 2.3
|
||||||
Item {
|
|
||||||
|
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 {
|
||||||
|
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 {
|
Row {
|
||||||
anchors.right: parent.right
|
x:0
|
||||||
|
y:0
|
||||||
spacing: 4
|
spacing: 4
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: 100
|
height: 100
|
||||||
width: 100
|
width: 100
|
||||||
@ -20,4 +44,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -6,10 +6,8 @@
|
|||||||
PLUGINLIB_EXPORT_CLASS(mg::DemoPluginMg, rqt_gui_cpp::Plugin)
|
PLUGINLIB_EXPORT_CLASS(mg::DemoPluginMg, rqt_gui_cpp::Plugin)
|
||||||
|
|
||||||
mg::DemoPluginMg::DemoPluginMg() : Plugin() {
|
mg::DemoPluginMg::DemoPluginMg() : Plugin() {
|
||||||
initResources();
|
|
||||||
QSurfaceFormat fmt;
|
QSurfaceFormat fmt;
|
||||||
fmt.setSwapInterval(0);
|
fmt.setSwapInterval(0);
|
||||||
fmt.setRenderableType(QSurfaceFormat::OpenGLES);
|
fmt.setRenderableType(QSurfaceFormat::OpenGLES);
|
||||||
QSurfaceFormat::setDefaultFormat(fmt);
|
QSurfaceFormat::setDefaultFormat(fmt);
|
||||||
}
|
}
|
||||||
mg::DemoPluginMg::~DemoPluginMg() { cleanupResources(); }
|
|
||||||
Reference in New Issue
Block a user