使用 QML 的全屏桌面应用程序
我有使用 Flex 和 AS3 开发丰富的用户界面应用程序的经验。然而问题是很难将现有的 C++ 业务逻辑与这些 Flex 应用程序一起使用。随着 QML 的出现,我很好奇是否可以通过 QT 重用 C++ 业务逻辑来实现丰富的 UI 应用程序。
我想知道是否可以为桌面开发全屏丰富的用户界面应用程序(这变得越来越常见,特别是在移动设备中)。例如(http://blog.flexexamples.com/2007/08/ 07/creating-full-screen-flex-applications/) Adobe 拥有可以在全屏模式下使用并运行用 AS3 编写的内容的 Flash Player。是否可以使用 QT/QML 编写类似的应用程序?
I have experience with developing rich user interface application with flex and AS3. However the issue is its very hard to use existing c++ business logic with these flex apps. With the advent of QML, I am curious whether its possible to reuse the c++ business logic with QT for rich UI apps.
I want to know whether its possible to develop full screen rich user interface applications(which are becoming more and more common especially in mobile devices) for the desktop. For example(http://blog.flexexamples.com/2007/08/07/creating-full-screen-flex-applications/) Adobe has the Flash Player which can be used in full screen mode and runs content written in AS3. Is it possible to write similar applications using QT/QML?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
还有一种仅 QML 的全屏方式。
如果您不使用 QDeclarativeView 而是使用 QQmlApplicationEngine,则可以使用此选项,因为后者不继承 QWidget 并且没有 showFullScreen() 方法。
但重要的是使用 ApplicationWindow 作为根元素而不是 Rectangle。对于ApplicationWindow,您必须导入QtQuick.Controls。
There is also a QML-only way to go fullscreen.
You can use this if you are not using QDeclarativeView but QQmlApplicationEngine, since the latter doesn't inherits QWidget and has not the method showFullScreen().
But it's important to use ApplicationWindow as the root-element and not Rectangle. For ApplicationWindow you have to import QtQuick.Controls.
如果您想使用用 C++ 编写的业务逻辑和一些 QML 用户界面,您可以在应用程序中使用
QDeclarativeView
。它只是一个常规的 Qt 小部件,因此它有方法showFullScreen()
。实际上这个类就像“应用程序中的qmlviewer”。因此,您会得到类似这样的信息:
您可以在此处找到更多信息。
If you would like to use business logic written on C++ and some QML user interface you can use
QDeclarativeView
inside your application. It's just a regular Qt widget so it has methodshowFullScreen()
. Actually this class is like "qmlviewer inside your application".So you'll get something like this:
You can find more information here.
在 C++ 中使用 QQmlApplicationEngine 时,您可以在 QML 中执行以下操作:
main.cpp
main.qml
使用 QT5.8 进行测试
When using QQmlApplicationEngine in c++ you can do something like this in QML:
main.cpp
main.qml
Tested with QT5.8
这是之前答案的另一个变体,但这使用(默认的 Qt Quick Application - Empty)Window QML 类型和 Qt 枚举:
Here is yet another variation from previous answers, but this uses the (default Qt Quick Application - Empty) Window QML type and a Qt enum:
Qt 有 qmlviewer。
要全屏运行它:
还有一个使用 QML 创建全屏应用程序的教程。
以及桌面小部件的组件。
Qt has qmlviewer.
To run it in fullscreen:
Also there is a tutorial of creating fullscreen applications with QML.
And components for desktop widgets.
你好,朋友,我知道这已经晚了 10 年,但我希望能帮助一些人。
要在 android 和 QML/quick 中将窗口设置为全屏,您可以使用以下代码:
hello friend i know that its late for 10 years but i hope to help some one.
for set windows to be Full Screen at android and others in QML/quick you can use this Code: