大家好,欢迎来到IT知识分享网。
Qt Android Activity View
Qt Android活动视图
Monday May 23, 2022 by Ramon Sadornil Rivera | Comments
2022年5月23日星期一 Ramon Sadornil Rivera 评论
Qt for Android Automotive creates a bridge between the world of Qt and the Android Automotive environment. It provides excellent flexibility in terms of accessing car data. Depending on the needs, you can use tools for automatic code generation based on a high-level description or ready-to-use QML components.
Qt for Android Automotive在Qt世界和Android Automotive环境之间架起了一座桥梁。它在访问汽车数据方面提供了极好的灵活性。根据需要,您可以使用工具根据高级描述或现成的QML组件自动生成代码。
The Qt Android ActivityView module has been added to Qt for Android Automotive in version 6.3.0. Currently, Android 10 and 11 are supported.
Qt Android ActivityView模块已添加到6.3.0版的Qt for Android Automotive中。目前,支持Android 10和11。
When it comes to UI, all the benefits provided by Qt are available. The natural choice is to use QML and Qt Design Studio to create a modern graphical interface quickly and efficiently.
说到UI,Qt提供的所有好处都是可用的。自然的选择是使用QML和Qt Design Studio快速高效地创建现代图形界面。
Often, however, there is a need to leverage existing Android applications – directly or after adaptation to specific requirements. An integrated home screen composed of selected embedded applications could be an example. The new Activity View module provides a component that allows embedding external Android applications into the Qt-based one. The feature is as easy to use as any other visual QML component, including support for Qt Design Studio.
然而,通常需要直接利用现有的Android应用程序,或者在适应特定需求之后利用现有的Android应用程序。例如,由选定的嵌入式应用程序组成的集成主屏幕。新的活动视图模块提供了一个组件,允许将外部Android应用程序嵌入到基于Qt的应用程序中。该功能与任何其他visual QML组件一样易于使用,包括对Qt Design Studio的支持。
The primary use case is as simple as the QML code below. You can position the component using anchors. Additionally, a busy indicator is displayed while the external application is loading:
主要用例与下面的QML代码一样简单。可以使用定位来定位构件。此外,在加载外部应用程序时,会显示忙指示灯:
import QtQuick
import QtQuick.Controls
import QtAndroidAutomotive.ActivityView
ApplicationWindow {
visible: true
BusyIndicator {
anchors.centerIn: parent
visible: activityView.status !== ActivityView.Started
}
ActivityView {
id: activityView
anchors.centerIn: parent
width: 600
height: 800
radius: 25
packageName: "com.google.earth"
}
}
Of course, you can also use ActivityView with layout components. The snippet below launches two applications positioned using a row layout:
当然,您也可以将ActivityView用于布局组件。下面的代码段启动了两个使用行布局定位的应用程序:
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtAndroidAutomotive.ActivityView
ApplicationWindow {
visible: true
RowLayout {
anchors.fill: parent
anchors.margins: 25
spacing: 25
ActivityView {
Layout.fillWidth: true
Layout.fillHeight: true
radius: 25
packageName: "com.google.earth"
}
ActivityView {
Layout.fillWidth: true
Layout.fillHeight: true
radius: 25
packageName: "com.android.deskclock"
}
}
}
You can also manipulate the component size and position dynamically. One of the examples provided with the module presents external applications wrapped in windows created in QML. Changing the location and size of an external application is a heavy operation. Therefore, the component allows you to define a placeholder that will be displayed, instead of the actual application, during these operations:
还可以动态操纵零部件的大小和位置。该模块提供的一个示例展示了包装在QML中创建的windows中的外部应用程序。更改外部应用程序的位置和大小是一项繁重的操作。因此,该组件允许您定义一个占位符,该占位符将在以下操作期间显示,而不是实际的应用程序:
In addition to the QML component, the Activity View module also provides a C++ API offering the same capabilities without dependence on QML.
除了QML组件之外,活动视图模块还提供了一个C++API,提供了相同的功能,而不依赖于QML。
Note, however, that Activity View is not a standard visual QML component managed by a scene graph. This implies some limitations. Every Activity View component is always rendered above the QML scene. It is also impossible to intercept events from the element, e.g., with the MouseArea.
但是,请注意,“活动视图”不是由场景图管理的标准visual QML组件。这意味着一些限制。每个“活动视图”组件始终渲染在QML场景上方。也不可能拦截来自元素的事件,例如,使用MouseArea。
You can find more details about the new module in the documentation: Qt Android Activity View.
您可以在文档:Qt Android活动视图中找到有关新模块的更多详细信息。
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/15123.html