当前位置: 首页>>代码示例>>C++>>正文


C++ QmlApplicationViewer::show方法代码示例

本文整理汇总了C++中QmlApplicationViewer::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QmlApplicationViewer::show方法的具体用法?C++ QmlApplicationViewer::show怎么用?C++ QmlApplicationViewer::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QmlApplicationViewer的用法示例。


在下文中一共展示了QmlApplicationViewer::show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);

#ifdef Q_OS_SYMBIAN
    viewer.setMainQmlFile(QLatin1String("qrc:/qml/qvapp/qv.qml"));
    viewer.setSource(QUrl(QLatin1String("qrc:/qml/qvapp/qv.qml")));
#else
    viewer.setMainQmlFile(QLatin1String("qml/qvapp/qv.qml"));
#endif

#ifdef Q_OS_SYMBIAN
    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    viewer.showFullScreen();
#elif defined(Q_WS_MAEMO_5)
    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    viewer.showMaximized();
#elif defined(Q_OS_ANDROID)
    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    viewer.showFullScreen();
#else
    Qt::WindowFlags flags = Qt::MSWindowsFixedSizeDialogHint
            | Qt::CustomizeWindowHint
            | Qt::WindowCloseButtonHint
            | Qt::WindowMinimizeButtonHint;
    viewer.setWindowFlags(flags);
    viewer.setResizeMode(QDeclarativeView::SizeViewToRootObject);
    viewer.show();
#endif

    return app.exec();
}
开发者ID:khris,项目名称:qv,代码行数:35,代码来源:main.cpp

示例2: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QmlApplicationViewer viewer;
    viewer.setMainQmlFile(QLatin1String("qml/gallery/main.qml"));
    viewer.show();

    return app.exec();
}
开发者ID:shentok,项目名称:qt-components-hildon,代码行数:9,代码来源:main.cpp

示例3: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    bool use_qml;
#ifdef USE_QML
    use_qml = true;
#else 
    use_qml = false;
#endif

    QStringList options = app.arguments();
    if (options.contains("--use-qml"))
        use_qml = true;
    if (options.contains("--dont-use-qml"))
        use_qml = false;

    if (use_qml) {
        qRegisterMetaType<DNSSECTest>("DNSSECTest");
        qmlRegisterType<DNSSECTest, 1>("DNSSECTools", 1, 0, "DNSSECTest");
        qmlRegisterType<TestManager, 1>("DNSSECTools", 1, 0, "TestManager");

        QmlApplicationViewer viewer;
        QDeclarativeContext *context;
        viewer.addImportPath(":/qml");
        viewer.setWindowIcon(QIcon(":/images/dnssec-check-64x64.png"));
        viewer.setWindowTitle("DNSSEC-Check");

        TestManager manager;
        context = viewer.rootContext();
        context->setContextProperty("testManager", &manager);

        #ifdef IS_MEEGO
        viewer.setSource(QUrl("qrc:/qml/MeegoDnssecCheck.qml"));
        #else
        viewer.setSource(QUrl("qrc:/qml/DnssecCheck.qml"));
        #endif


        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
        #ifdef IS_MEEGO
        viewer.showFullScreen();
        #else
        viewer.show();
        #endif

        return app.exec();
    } else { // don't use QML
        MainWindow mainWindow;
        mainWindow.setOrientation(MainWindow::Auto);

        #ifdef Q_OS_SYMBIAN
        mainWindow.showFullScreen();
        #elif defined(Q_WS_MAEMO_5)
        mainWindow.showMaximized();
        #else
        mainWindow.show();
        #endif

        return app.exec();
    }
}
开发者ID:mcr,项目名称:dnssec-tools,代码行数:62,代码来源:main.cpp


注:本文中的QmlApplicationViewer::show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。