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


C++ QtQuick2ApplicationViewer::setSource方法代码示例

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


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

示例1: main

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
    qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");

    Configuration m_configuration;
    SerialLink m_serialLink;
    MavLinkManager m_mavlink_manager;

    LinkManager m_gLinkManager;

    QtQuick2ApplicationViewer viewer;
    QtQuick2ApplicationViewer splashscreen;

    QString customPath = "Sqlite/OfflineStorage";
    QDir dir;
    if(dir.mkpath(QString(customPath))){
//        qDebug() << "Default path >> "+viewer.engine()->offlineStoragePath();
        viewer.engine()->setOfflineStoragePath(QString(customPath));
//        qDebug() << "New path >> "+viewer.engine()->offlineStoragePath();
    }
    // using as normal
//    viewer.setMainQmlFile(QStringLiteral("qml/gStabiSC/main.qml"));
    // using qml files form resources file, uncomment this to compile all qml file to .exe

    splashscreen.setSource(QUrl("qrc:/qml/gStabiSC/GSplashScreen.qml"));
    splashscreen.setFlags(Qt::FramelessWindowHint);
    splashscreen.setMinimumSize(QSize(1000,500));
    splashscreen.show();


    viewer.setSource(QUrl("qrc:/qml/gStabiSC/GMain.qml"));
    viewer.setTitle(QString("%1 %2").arg(APPLICATION_NAME).arg(APPLICATION_VERSION));
    viewer.setMinimumSize(QSize(APPLICATION_WIDTH,APPLICATION_HEIGHT));
    viewer.setMaximumSize(QSize(APPLICATION_WIDTH,APPLICATION_HEIGHT));

//    viewer.addImportPath("qrc:/qml/gStabiSC");
//    viewer.addImportPath("qrc:/qml/gStabiSC/Components");
//    viewer.addImportPath("qrc:/qml/gStabiSC/GDashboard");
//    viewer.addImportPath("qrc:/javascript/storage.js");

    viewer.rootContext()->setContextProperty("_configuration",&m_configuration);
    viewer.rootContext()->setContextProperty("_serialLink", &m_serialLink);
    viewer.rootContext()->setContextProperty("_mavlink_manager", &m_mavlink_manager);

    m_gLinkManager.connectLink(&m_serialLink,&m_mavlink_manager);

    QTimer::singleShot(3000, &splashscreen, SLOT(close()));
    QTimer::singleShot(3000, &viewer, SLOT(show()));

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

示例2: main

int main(int argc, char *argv[])
{
    qDebug("[Salticidae] Init Salticidae v%s", PROJECT_VERSION);

    QCoreApplication::setOrganizationName("Rabits");
    QCoreApplication::setOrganizationDomain("rabits.org");
    QCoreApplication::setApplicationName("salticidae");
    QCoreApplication::setApplicationVersion(PROJECT_VERSION);

    QGuiApplication app(argc, argv);

    Eyes::registerQmlTypes();
    PluginManager::initPlugins();

    QtQuick2ApplicationViewer viewer;

    Eyes::I()->initContext(viewer, &app);

    qDebug("[Salticidae] Loading qml");
    viewer.setSource(QUrl("qrc:/qml/salticidae/main.qml"));
    QObject::connect(viewer.engine(), SIGNAL(quit()), &viewer, SLOT(close()));

    Eyes::I()->initRoot(viewer);

    qDebug("[Salticidae] Init done, starting");

    viewer.showExpanded();
    return app.exec();
}
开发者ID:rabits,项目名称:salticidae,代码行数:29,代码来源:main.cpp

示例3: main

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    QtQuick2ApplicationViewer viewer;

    NestedListModel* platforms = new NestedListModel(new UPlatform);

    UPlatform* platform1 = createPlatform(platforms, 1);
    UPlatform* platform2 = createPlatform(platforms, 2);
    UPlatform* platform3 = createPlatform(platforms, 3);

    ListModel* devices1 = platform1->nestedModel();
    ListModel* devices2 = platform2->nestedModel();
    ListModel* devices3 = platform3->nestedModel();

    UDevice* device1 = createDevice(devices1, 1);
    UDevice* device2 = createDevice(devices2, 2);
    UDevice* device3 = createDevice(devices3, 3);

    ListModel* scenarios1 = device1->nestedModel();
    ListModel* scenarios2 = device2->nestedModel();
    ListModel* scenarios3 = device3->nestedModel();

    UScenario* scenario1 = createScenario(scenarios1, 1);
    UScenario* scenario2 = createScenario(scenarios2, 2);
    UScenario* scenario3 = createScenario(scenarios3, 3);

    ListModel* tasks1 = scenario1->nestedModel();
    ListModel* tasks2 = scenario2->nestedModel();
    ListModel* tasks3 = scenario3->nestedModel();

    UTask* taks1 = createTask(tasks1, 1);
    UTask* taks2 = createTask(tasks2, 2);
    UTask* taks3 = createTask(tasks3, 3);

    ListModel* conditions1 = taks1->nestedModel();
    ListModel* conditions2 = taks2->nestedModel();
    ListModel* conditions3 = taks3->nestedModel();

    createCondition(conditions1, 1);
    createCondition(conditions2, 2);
    createCondition(conditions3, 3);

    QQmlContext* ctxt = viewer.rootContext();
    ctxt->setContextProperty("platformsModel", platforms);

    viewer.setSource(QUrl("qrc:///main.qml"));
    viewer.show();

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


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