RV1126&RV1109 buildroot 增加QT程序

1、先看效果

2、上代码补丁

From 08f234148d543a546e6f64ebbba31e379424322a Mon Sep 17 00:00:00 2001
From: rockemd <rockemd2020@163.com>
Date: Wed, 18 Nov 2020 18:19:02 +0800
Subject: [PATCH] qhellotest

---
 app/qhellotest/main.cpp                            | 11 ++++++
 app/qhellotest/mainwindow.cpp                      | 15 ++++++++
 app/qhellotest/mainwindow.h                        | 21 ++++++++++
 app/qhellotest/mainwindow.ui                       | 45 ++++++++++++++++++++++
 app/qhellotest/qhellotest.pro                      | 28 ++++++++++++++
 .../rockchip_rv1126_rv1109_facial_gate_defconfig   |  1 +
 buildroot/package/rockchip/Config.in               |  1 +
 buildroot/package/rockchip/qhellotest/Config.in    |  4 ++
 .../package/rockchip/qhellotest/qhellotest.mk      | 23 +++++++++++
 9 files changed, 149 insertions(+)
 create mode 100755 app/qhellotest/main.cpp
 create mode 100755 app/qhellotest/mainwindow.cpp
 create mode 100755 app/qhellotest/mainwindow.h
 create mode 100755 app/qhellotest/mainwindow.ui
 create mode 100755 app/qhellotest/qhellotest.pro
 mode change 100644 => 100755 buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig
 mode change 100644 => 100755 buildroot/package/rockchip/Config.in
 create mode 100755 buildroot/package/rockchip/qhellotest/Config.in
 create mode 100755 buildroot/package/rockchip/qhellotest/qhellotest.mk

diff --git a/app/qhellotest/main.cpp b/app/qhellotest/main.cpp
new file mode 100755
index 0000000..aff48df
--- /dev/null
+++ b/app/qhellotest/main.cpp
@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+    return a.exec();
+}
diff --git a/app/qhellotest/mainwindow.cpp b/app/qhellotest/mainwindow.cpp
new file mode 100755
index 0000000..79c64b9
--- /dev/null
+++ b/app/qhellotest/mainwindow.cpp
@@ -0,0 +1,15 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent)
+    : QMainWindow(parent)
+    , ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
diff --git a/app/qhellotest/mainwindow.h b/app/qhellotest/mainwindow.h
new file mode 100755
index 0000000..934b0f3
--- /dev/null
+++ b/app/qhellotest/mainwindow.h
@@ -0,0 +1,21 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QWidget *parent = nullptr);
+    ~MainWindow();
+
+private:
+    Ui::MainWindow *ui;
+};
+#endif // MAINWINDOW_H
diff --git a/app/qhellotest/mainwindow.ui b/app/qhellotest/mainwindow.ui
new file mode 100755
index 0000000..0b7ae14
--- /dev/null
+++ b/app/qhellotest/mainwindow.ui
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>364</width>
+    <height>293</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QLabel" name="label">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>100</y>
+      <width>361</width>
+      <height>131</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>rockemd QT!</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>364</width>
+     <height>23</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/app/qhellotest/qhellotest.pro b/app/qhellotest/qhellotest.pro
new file mode 100755
index 0000000..4ec32ea
--- /dev/null
+++ b/app/qhellotest/qhellotest.pro
@@ -0,0 +1,28 @@
+QT += widgets
+
+CONFIG += c++11 console
+
+TARGET = qhellotest
+TEMPLATE = app
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which as been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+#DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+    main.cpp \
+    mainwindow.cpp
+
+HEADERS += \
+    mainwindow.h
+
+FORMS += \
+    mainwindow.ui
+
diff --git a/buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig b/buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig
old mode 100644
new mode 100755
index 71e9632..e325a85
--- a/buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig
+++ b/buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig
@@ -24,6 +24,7 @@ BR2_PACKAGE_RKMEDIA_ANR=y
 BR2_PACKAGE_RKMEDIA_AEC=y
 BR2_PACKAGE_RKMEDIA_EXAMPLES=y
 BR2_PACKAGE_QFACIALGATE=y
+BR2_PACKAGE_QHELLOTEST=y
 # BR2_PACKAGE_MINIGUI_SOFTWARE_SCALE is not set
 BR2_PACKAGE_RKNPU_USE_MINI_DRIVER=y
 BR2_PACKAGE_RKFACIAL_USE_WEB_SERVER=y
diff --git a/buildroot/package/rockchip/Config.in b/buildroot/package/rockchip/Config.in
old mode 100644
new mode 100755
index 6735cdc..8cb643b
--- a/buildroot/package/rockchip/Config.in
+++ b/buildroot/package/rockchip/Config.in
@@ -180,6 +180,7 @@ source "package/rockchip/carmachine/Config.in"
 source "package/rockchip/gallery/Config.in"
 source "package/rockchip/QLauncher/Config.in"
 source "package/rockchip/QFacialGate/Config.in"
+source "package/rockchip/qhellotest/Config.in"
 source "package/rockchip/settings/Config.in"
 source "package/rockchip/qcamera/Config.in"
 source "package/rockchip/qfm/Config.in"
diff --git a/buildroot/package/rockchip/qhellotest/Config.in b/buildroot/package/rockchip/qhellotest/Config.in
new file mode 100755
index 0000000..7b18811
--- /dev/null
+++ b/buildroot/package/rockchip/qhellotest/Config.in
@@ -0,0 +1,4 @@
+config BR2_PACKAGE_QHELLOTEST
+	bool "qhellotest"
+	help
+		rockemd qt test
\ No newline at end of file
diff --git a/buildroot/package/rockchip/qhellotest/qhellotest.mk b/buildroot/package/rockchip/qhellotest/qhellotest.mk
new file mode 100755
index 0000000..8a9dbc4
--- /dev/null
+++ b/buildroot/package/rockchip/qhellotest/qhellotest.mk
@@ -0,0 +1,23 @@
+################################################################################
+#
+# qhellotest
+#
+################################################################################
+
+QHELLOTEST_VERSION = 1.0
+QHELLOTEST_SITE = $(TOPDIR)/../app/qhellotest
+QHELLOTEST_SITE_METHOD = local
+
+QHELLOTEST_LICENSE = Apache V2.0
+QHELLOTEST_LICENSE_FILES = NOTICE
+define QHELLOTEST_CONFIGURE_CMDS
+cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/bin/qmake 
+endef
+define QHELLOTEST_BUILD_CMDS
+$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) 
+endef
+
+define QHELLOTEST_INSTALL_TARGET_CMDS
+$(INSTALL) -D -m 0755 $(@D)/qhellotest $(TARGET_DIR)/usr/bin/qhellotest
+endef
+$(eval $(generic-package))
-- 
2.7.4

 

3、开发调试步骤

3.1、在PC机上安装QT开发环境,新建工程(这里不详细介绍),可参考rockchip官方文档 《docs\Linux\ApplicationNote\Rockchip_Developer_Guide_Linux_Qt_CN.pdf》

3.2、移植QT工程(见补丁)

3.3、编译调试如下:

source build/envsetup.sh

72. rockchip_rv1126_rv1109
73. rockchip_rv1126_rv1109_facial_gate
74. rockchip_rv1126_rv1109_libs
75. rockchip_rv1126_rv1109_ramboot_uvcc
76. rockchip_rv1126_rv1109_recovery
77. rockchip_rv1126_rv1109_sl
78. rockchip_rv1126_rv1109_spi_nand
79. rockchip_rv1126_rv1109_systemd
80. rockchip_rv1126_rv1109_toolchain
81. rockchip_rv1126_rv1109_uvcc
82. rockchip_rv1126_rv1109_uvcc_spi_nand
Which would you like? [0]: 73   <--------------------------------------

make qhellotest-rebuild

编译成功生成可执行程序目录:rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109_facial_gate/target/usr/bin/qhellotest


adb push Z:\rv1126_rv1109\buildroot\output\rockchip_rv1126_rv1109_facial_gate\target\usr\bin\qhellotest \usr\bin\

adb shell
[root@ROCKEMD:/]#  chmod 777 /usr/bin/qhellotest
[root@ROCKEMD:/]#  export QT_QPA_FB_DRM=1
[root@ROCKEMD:/]#  export QT_QPA_PLATFORM=linuxfb:rotation=0
[root@ROCKEMD:/]#  qhellotest &

技术交流群: 微信号
===========================================

  • 5
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
在Ubuntu中使用Qt和OpenCV可以按照以下步骤进行配置: 1. 首先,确保你已经安装了Qt和OpenCV库文件。在库的目录里检查是否有OpenCV的库文件。 2. 新建一个Qt工程,并在.pro文件中添加INCLUDEPATH和LIBS指令来引入OpenCV库文件。例如: ``` INCLUDEPATH += /home/hello/opencv/opencv3.4/include \ /home/hello/opencv/opencv3.4/include/opencv \ /home/hello/opencv/opencv3.4/include/opencv2 LIBS += /home/hello/opencv/opencv3.4/lib/libopencv_* ``` 3. 编译完成后,需要为OpenCV配置环境变量。使用以下命令打开配置文件: ``` sudo gedit /etc/ld.so.conf.d/opencv.conf ``` 4. 在打开的文件中,添加OpenCV库文件的路径。保存并关闭文件。 5. 在使用OpenCV库之前,必须添加环境变量。使用以下命令跳转到目录/etc/ld.so.conf.d/: ``` cd /etc/ld.so.conf.d/ ``` 6. 创建一个名为opencv.conf的文件,并编辑该文件: ``` sudo vim opencv.conf ``` 7. 在打开的文件中,添加OpenCV库文件的路径。保存并关闭文件。 通过以上步骤,你就可以在Ubuntu的Qt项目中成功使用OpenCV库了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Ubuntu下Qt编译opencv+配置(超详细)](https://blog.csdn.net/dongdong_csdn/article/details/85217292)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [Ubuntu18.04交叉编译QT+opencv4.2.0至rv1106开发板全过程及踩坑](https://blog.csdn.net/Mei_Ying_/article/details/131105656)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值