Qt-Quick 介绍

1 简介

2 优缺点

widgets 只能由CPU渲染,不能利用 opengl 加速。而 qml 则可以。

在桌面平台,大家的CPU往往性能过剩,widgets 还是满足需求的。
在嵌入式平台,很多低端设备甚至都没有图形加速器,或不支持opengl,只能用widgets
在移动端平台,没有gpu加速可能就会“不丝滑”,手感不好。所以用 qml 会有更好的体验

我在做一个demo, UVC Camera上来一帧显示一帧, 实际上在QOpenGLWidget的paintEvent里刷帧(没使用OpenGL) 照样很占CPU, 我认为一定要用paintGL

互联网,顺手就行,性能不用考虑
嵌入式电子设备、物联网,必须是c/c++才行。关键代码只能是C,C++都用不了 …

使用 QML 语言进行 Qt 应用程序开发可以将界面开发和逻辑控制分开,提高应用的开发周期和灵活性;另外对于多媒体应用非常重要的一点是,基于 QML/Qt Quick 的应用程序可以直接调用 GPU 进行加速,这大大提高了多媒体应用在嵌入式系统环境下的处理效率和资源占用
性能
https://www.toradex.com/zh-cn/blog/qian-ru-shilinux-ji-yuqml-kai-faqt-multimedia-ying-yong

3 资料汇总

3.1 书籍

3.2 网站

3.3 博客

4 示例

https://support.crosscontrol.com/kb/qtquick-qml-programming
在这里插入图片描述
In this article, one approach will be presented how signals in the Data Engine can be connected to QML components. Signal values can either be presented in the GUI for a user or be updated through user input with the GUI.
Goal:

  • Set signal value from GUI (qml) and send the value to the Data Engine
  • Read value from Data Engine and view it in the GUI (qml)
    Achieved by:
  • Write a C++ backend to handle communication with Data Engine
  • Class with Q Properties defines the signals
  • QML-binds to properties in the signal class handler
    The following structure will be used for both projects to achieve the previously mentioned goal:
    在这里插入图片描述
    Viewer
  • The Viewer is what the user will see and interact with. It is written with QML and property bindings will be used to bind certain component properties. It communicates with the backend parts Data Engine Control or Data Engine Signal.

Data Engine Signal

  • Defines the signals which should be used by the application. Signals are created as properties which the Viewer can bind to. The name of the signals must follow a specific pattern for the current implementation. Will be presented further on in the article.

Data Engine Control

  • A central piece for this project and the backend. It handles the communication with the Data Engine through the sapcore interface or by receiving data from the observer. It is also responsible to update signals defined as properties in Data Engine Signal.

Observer

  • Receives data from the sapcore interface, such as subscribe result or data for updated signals. Pushes the information to the Data Engine Control which then handles the received data. It’s a part of the Data Engine Control.

Receiver
Signal updates are received from the Observer which is a part of the Data Engine Control. Once a new value arrives, the ID will be checked in one of the used dictionaries to find the corresponding signal name. Once found, it will use the signal handle previously set during the initialization to update the correct property in Data Engine Signal. The property is updated using the WRITE method associated to the signal, which will trigger the GUI to read the new value thanks to the notify signal.
在这里插入图片描述
Sender
When Data Engine Signals emits the signal to send data, the slot connected to the signal will be activated, in this case sendToServer(value,name). The method needs to get the ID associated with the name of the signal, this is done by reading the name paired with the key value ID. Once the ID is known, it is just a matter to set the value using the SAP method SetValue(id,value) available in the sapcore-library.
在这里插入图片描述

5 作品

记录开源Qt/Qml 作品链接

参考

1、
2、怎么看 widgets 与 qml 未来的发展
3、QOpenGLWidget 绘图选择paintEvent还是 paintGL,两者有什么区别吗?都能开启硬件加速吗?
4、学 Qt-widget 还是 Qt-quick?求大佬指教
5、i.mx6q 移植Qt5.9.1(完美支持opengl、Qt quick2、QML)
6、QML移植到ARM
7、移植Qt5.6到imx6系列处理器移植过程说明–支持qml
8、嵌入式Linux基于QML开发QT Multimedia应用
9、显著改善了Qt Quick 和 QML之性能,尤其在ARM平台上之Linux。QML引擎,Qt Quick 图形,Qt QML编译器,Qt Quick 控件,相对于5.6,有些方面的性能提高了数倍。
10、Template:FriendlyCoreRK3399QtDev/zh
11、Qt Quick 之 QML 与 C++ 混合编程详解
12、Introduction to Qt Quick for C++ Developers

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 技术黑板 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读