Difference between revisions of "Template:FriendlyCoreRK3399QtDev"
(→Develop Qt Application) |
(→Develop Qt Application) |
||
Line 62: | Line 62: | ||
* 2:Setup a local cross-compiler. You need to run a Ubuntu 18.04 64-bit OS and you can refer to :[[How to Build and Install Qt Application for FriendlyELEC Boards/zh]] | * 2:Setup a local cross-compiler. You need to run a Ubuntu 18.04 64-bit OS and you can refer to :[[How to Build and Install Qt Application for FriendlyELEC Boards/zh]] | ||
− | ==== | + | ====Qt Demo==== |
− | + | FriendlyCore has several Qt demo programs: | |
− | * <b>Qt | + | * <b>Qt QML: CinematicExperience</b> |
− | + | CinematicExperience is a utility for selecting a video file and it is developed with Qt QML.<br /> | |
− | + | This demo uses Qt QML's various features and runs very smoothly on RK3399. This performance is achieved by hardware and software optimization.<br /> | |
− | + | You can start it in a commandline utility by running the following commands:<br /> | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cd /opt/Qt5_CinematicExperience | cd /opt/Qt5_CinematicExperience | ||
./run.sh | ./run.sh | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Here is what it looks like:<br /> | |
[[File:Cinematicsexperience.jpg|frameless|480px]]<br /> | [[File:Cinematicsexperience.jpg|frameless|480px]]<br /> | ||
− | * <b>QQt | + | * <b>QQt WebEngine: web browser</b> |
− | Qt | + | Qt WebEngine uses Chromium and supports HTML5.<br /> |
− | + | You can start it by running the following commands:<br /> | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cd /opt/qt5-brower | cd /opt/qt5-brower | ||
Line 83: | Line 83: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Here is what it looks like:<br /> | |
[[File:qt5-brower.jpg|frameless|480px]]<br /> | [[File:qt5-brower.jpg|frameless|480px]]<br /> | ||
− | + | Note:Qt WebEngine depends on the Xcb plug-in. | |
− | * <b>Qt | + | * <b>Qt Different Display</b> |
− | + | This demo shows that when a board is connected to an HDMI monitor and an eDP LCD these two devices display differently. You can start it by running the following commands: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cd /opt/qt5-multi-screen-demo | cd /opt/qt5-multi-screen-demo | ||
./run.sh | ./run.sh | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Here is what it looks like:<br /> | |
[[File:qt5-multi-screen.jpg|frameless|480px]]<br /> | [[File:qt5-multi-screen.jpg|frameless|480px]]<br /> | ||
Revision as of 16:00, 29 July 2018
1 Develop Qt Application
The Qt 5.10.0 FriendlyELEC ported for RK3399 supports the following plug-ins:KMS, EGLFS and XCB. All these three plug-ins support OpenGL ES and GPU hardware acceleration but in different ways:
- KMS - it calls Linux kernel's DRM interface to display
- EGLFS - it calls OpenGL ES interface to display
- XCB - it runs on X11 server and is integrated in X11 windows system
Three plug-ins support different Qt features and here is a table:
Plug-in OpenGL ES QtWebEngine QtMultimedia Video Playing with Hardware Decoding Different Display KMS Yes No Yes No Yes EGLFS Yes No Yes No No XCB Yes Yes Yes Yes Yes
We recommend to use KMS or XCB.
FriendlyCore has four scripts for setting Qt environmental variables for users and here is a table:
Script Comment /usr/bin/setqt5env-kms set kms' environmental variables /usr/bin/setqt5env-eglfs set eglfs' environmental variables /usr/bin/setqt5env-xcb set xcb's environmental variables /usr/bin/setqt5env-nogui set environmental variables for a system without a Qt GUI
For instance, if you want to use KMS to display you can run the following commands:
. setqt5env-kms
./apps
(Note:there is a space between '.' and 's')
1.1 Setup Qt Development Envronment
FriendlyELEC developed two methods for RK3399 to cross-compile a Qt program:
- 1:Use Docker. For more details you can refer to github :http://github.com/friendlyarm/friendlyelec-ubuntu18-docker
- 2:Setup a local cross-compiler. You need to run a Ubuntu 18.04 64-bit OS and you can refer to :How to Build and Install Qt Application for FriendlyELEC Boards/zh
1.2 Qt Demo
FriendlyCore has several Qt demo programs:
- Qt QML: CinematicExperience
CinematicExperience is a utility for selecting a video file and it is developed with Qt QML.
This demo uses Qt QML's various features and runs very smoothly on RK3399. This performance is achieved by hardware and software optimization.
You can start it in a commandline utility by running the following commands:
cd /opt/Qt5_CinematicExperience ./run.sh
- QQt WebEngine: web browser
Qt WebEngine uses Chromium and supports HTML5.
You can start it by running the following commands:
cd /opt/qt5-brower ./run.sh
Note:Qt WebEngine depends on the Xcb plug-in.
- Qt Different Display
This demo shows that when a board is connected to an HDMI monitor and an eDP LCD these two devices display differently. You can start it by running the following commands:
cd /opt/qt5-multi-screen-demo ./run.sh
- Qt Multimedia: 硬解播放器qt5-player
qt5-player播放器已经适配Rockchip的gstreamer插件,支持4K视频的硬解播放,由于Rockchip提供的插件只支持输出图像到X11窗口,因此 Qt 播放器程序需要使用 XCB 的显示插件来运行。
在命令行执行以下命令启动该示例:
cd /opt/qt5-player ./run.sh
- Qt WebGL示例: nmapper
Qt WebGL允许你在其他设备的网页游览器查看并远程操作运行在开发板上的Qt程序,这个特性使得实现远程控制变得简单。
在运行示例之前,你的开发板需要先连接网络,然后在开发版本执行以下命令:
cd /opt/qt5-nmapper ./run-with-webgl.sh
然后在电脑或者手机上打开网页游览器,在浏览器的地址栏输入开发板的IP地址,应该就能看到Qt界面了,效果如下所示:
- Qt VNC示例: 智能家居控制界面
Qt VNC允许你将一个应用程序以VNC Server的形式运行,在其他设备上可以使用VNC Client来连接和控制,用QtWidgets或者QML编写的应用都是支持的。
执行以下命令启动:
cd /opt/qt5-smarthome ./run-with-vnc.sh
然后在电脑或者手机上安装并打开VNC viewer软件,输入开发板的IP地址加端口号5900,例如开发板的地址是192.168.1.100,就输入192.168.1.100:5900,连接后应该就能看到界面了,如下图所示: