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


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

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


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

示例1: main

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    //Создание структуры объектов

    //CanDevice* canDevice = SocketCanDevice::instance();
    CanDevice* canDevice = EmulationCanDevice::instance();
    canDevice->registerCanUnit(CanUnitCapno1::instance());
    canDevice->registerCanUnit(CanUnitCapno2::instance());
    canDevice->registerCanUnit(CanUnitPower::instance());
    canDevice->registerCanUnit(CanUnitSPO::instance());
    canDevice->registerCanUnit(CanUnitKIVL::instance());
    canDevice->registerCanUnit(CanUnitMix::instance());

    RegimeManager::instance();
    CanManager::instance();
    EventManager::instance();
    GraphicManager::instance();
    OptionsManager::instance();

    VentModeManager::instance();
    TranslationManager::instance();
    QObject::connect(canDevice,SIGNAL(canDeviceModeChanged(CanDevice::canDeviceModes)),
                     RegimeManager::instance(), SLOT(slotCanDeviceMode(CanDevice::canDeviceModes)));

    //Регистрация перечислений для QML
    qmlRegisterUncreatableType<CanUnitMix>("CppImport", 1, 0, "CanUnitMix", "NOT MAY CREATE");
    qmlRegisterUncreatableType<CanUnitKIVL>("CppImport", 1, 0, "CanUnitKIVL", "NOT MAY CREATE");
    qmlRegisterUncreatableType<MeasureParameter>("CppImport", 1, 0, "MeasureParameter", "NOT MAY CREATE");
    qmlRegisterUncreatableType<TunningParameter>("CppImport", 1, 0, "TunningParameter", "NOT MAY CREATE");
    qmlRegisterUncreatableType<AssociatedParameter>("CppImport", 1, 0, "AssociatedParameter", "NOT MAY CREATE");
    qmlRegisterUncreatableType<EventIDs>("CppImport", 1, 0, "EventIDs", "NOT MAY CREATE");
    qmlRegisterUncreatableType<EventTypes>("CppImport", 1, 0, "EventTypes", "NOT MAY CREATE");
    qmlRegisterUncreatableType<CanUnitPower>("CppImport", 1, 0, "CanUnitPower", "NOT MAY CREATE");
    qmlRegisterUncreatableType<CanUnit>("CppImport", 1, 0, "CanUnit", "NOT MAY CREATE");
    qmlRegisterUncreatableType<RegimeManager>("CppImport", 1, 0, "RegimeManager", "NOT MAY CREATE");
    qmlRegisterUncreatableType<VentModeManager>("CppImport", 1, 0, "VentModeManager", "NOT MAY CREATE");

    //Создание представления и контекста QML
    QtQuick2ApplicationViewer viewer;
    QQmlContext* ctx = viewer.rootContext();


    //регистрация объектов для QML
    ctx->setContextProperty("keySim",         new KeyboardSimulator());
    ctx->setContextProperty("tm",             TranslationManager::instance());
    ctx->setContextProperty("regimeManager",  RegimeManager::instance());
    ctx->setContextProperty("canUnitMix",     CanUnitMix::instance());
    ctx->setContextProperty("canUnitKIVL",    CanUnitKIVL::instance());
    ctx->setContextProperty("canUnitPower",   CanUnitPower::instance());    
    ctx->setContextProperty("eventManager",   EventManager::instance());
    ctx->setContextProperty("ventModeManager",VentModeManager::instance());
    ctx->setContextProperty("graphicManager", GraphicManager::instance());
    ctx->setContextProperty("canManager",     CanManager::instance());
    CanUnitKIVL::instance()->bindContext(ctx);
    CanUnitCapno1::instance()->bindContext(ctx);
    VentModeManager::instance()->bindContext(ctx);
    GraphicManager::instance()->bindContext(ctx);
    OptionsManager::instance()->bindContext(ctx);


    viewer.setMainQmlFile(QStringLiteral("qml/BaseIVL2/main.qml"));
    viewer.setWidth(1024);
    viewer.setHeight(768);
    viewer.setColor(QColor::fromRgb(0,0,0,0)/*Qt::transparent*/);
    viewer.showExpanded();

    canDevice->startInit();
    return app.exec();
}
开发者ID:oosavu,项目名称:IVL,代码行数:70,代码来源:main.cpp


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