具有QML的全屏桌面应用程序 [英] Full-screen desktop application with QML

查看:655
本文介绍了具有QML的全屏桌面应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用Flex和AS3开发丰富的用户界面应用程序的经验.但是,问题在于,很难在这些flex应用程序中使用现有的c ++业务逻辑.随着QML的到来,我很好奇是否有可能将Q ++的c ++业务逻辑重用于丰富的UI应用程序.

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.

我想知道是否有可能为台式机开发全屏的,丰富的用户界面应用程序(尤其是在移动设备中,这种情况越来越普遍).例如( http://blog.flexexamples.com/2007/08/07/creating-full-screen-flex-applications/)Adobe具有Flash Player,可以在全屏模式下使用它并运行以AS3编写的内容.是否可以使用QT/QML编写类似的应用程序?

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?

推荐答案

如果您想使用用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 method showFullScreen(). Actually this class is like "qmlviewer inside your application".

所以您会得到类似这样的信息:

So you'll get something like this:

#include <QtGui/QApplication>
#include <QtDeclarative/QDeclarativeView>
#include <QtCore/QUrl>

int main(int _argc, char * _argv[])
{
    QApplication app(_argc, _argv);

    QDeclarativeView view;
    view.setSource(QUrl("qrc:/MyGui.qml"));    // if your QML files are inside 
                                               // application resources

    view.showFullScreen();    // here we show our view in fullscreen

    return app.exec();
}

您可以在此处找到更多信息.

You can find more information here.

这篇关于具有QML的全屏桌面应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆