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


C++ QQmlApplicationEngine::addImageProvider方法代码示例

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


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

示例1: main

int main(int argc, char *argv[])
{
    avcodec_register_all();
    memset(frame,0,sizeof(AVFrame));
    QApplication app(argc, argv);
    qmlRegisterType<Connection> ("ybh1998.Connection",0,1,"Connection");
    QQmlApplicationEngine engine;
    engine.addImageProvider(QLatin1String("player"),new ImageProvider);
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    return app.exec();
}
开发者ID:ybh1998,项目名称:remote_play_client,代码行数:11,代码来源:main.cpp

示例2: main

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

  QQmlApplicationEngine engine;

  QThread *cameraThread = new QThread(&app);
  cameraThread->start();
  CameraCapturer *capturer = new CameraCapturer();
  CameraImageProvider *imageProvider = new CameraImageProvider();
  capturer->moveToThread(cameraThread);
  imageProvider->moveToThread(cameraThread);
  QObject::connect(capturer, static_cast<void (CameraCapturer::*)(QImage)>(
                     &CameraCapturer::frame),
                   imageProvider, &CameraImageProvider::setImage);
  engine.addImageProvider("camera", imageProvider);

  QThread *imageProcessingThread = new QThread(&app);
  imageProcessingThread->start();
  SquintDetector *squintDetector = new SquintDetector();
  squintDetector->moveToThread(imageProcessingThread);
  qRegisterMetaType<cv::Mat>("cv::Mat");
  QObject::connect(capturer, static_cast<void (CameraCapturer::*)(cv::Mat)>(
                     &CameraCapturer::frame),
                   squintDetector, &SquintDetector::updateFrame);

  capturer->startCapture(16);

  engine.load(QUrl(QStringLiteral("qrc:///main.qml")));

  QObject *mainWindow = engine.rootObjects()[0];
  QObject *arkanoid = mainWindow->children()[0];
  ArkanoidManager *aManager = new ArkanoidManager(arkanoid);

  QObject::connect(squintDetector, &SquintDetector::leftEye,
                   aManager, &ArkanoidManager::leftEye);
  QObject::connect(squintDetector, &SquintDetector::rightEye,
                   aManager, &ArkanoidManager::rightEye);
  QObject::connect(squintDetector, &SquintDetector::noEye,
                   aManager, &ArkanoidManager::noEye);
  QObject::connect(squintDetector, &SquintDetector::bothEyes,
                   aManager, &ArkanoidManager::bothEyes);

  QObject::connect(&app, &QGuiApplication::aboutToQuit, [=]() {
//    capturer->stopCapture();
//    delete capturer;
//    delete imageProvider;
//    cameraThread->exit();
//    delete squintDetector;
//    imageProcessingThread->exit();
    qDebug() << "bye";
  });

  return app.exec();
}
开发者ID:39dotyt,项目名称:squinting-arkanoid,代码行数:54,代码来源:main.cpp

示例3: main

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

    QQmlApplicationEngine engine;
    PizzaProvider * pizza_provider = new PizzaProvider; // provides the pixel buffer
    PizzaBuilder    builder(pizza_provider,&app);       // provides C++ interface to data
    engine.addImageProvider("live", pizza_provider);

	/********************** NOTE FROM GARY ******************************
	* Corporate shut me down. I was so close to realizing the pizza 
	* builder. I hope this PizzaProvider and PizzaBuilder object help
	* you build what corporate is looking for. If not start packing.
	*********************************************************************/

    // uncomment this line to connect the PizzaBuilder
    engine.rootContext()->setContextProperty("PizzaBuilder", &builder);
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

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

示例4: drawableProvider

void QuickAndroidTests::drawableProvider()
{
    QQmlApplicationEngine engine;
    QADrawableProvider* provider = new QADrawableProvider();

    provider->setBasePath(QString(SRCDIR) + "/res");
    engine.addImageProvider("drawable",provider);
    engine.load(QUrl::fromLocalFile(QString(SRCDIR) + "/test_drawableprovider.qml"));

    QObject *rootItem = engine.rootObjects().first();

    QVERIFY(rootItem);

    QStringList images;
    images << "image1" << "image2" << "image3";

    Q_FOREACH(QString image,images) {
        QQuickItem* item = rootItem->findChild<QQuickItem*>(image);
        QVERIFY(item);
        QCOMPARE(item->property("status").toInt() , 1) ;
    }
开发者ID:vishnuQtdeveloper,项目名称:quickandroid,代码行数:21,代码来源:tst_quickandroidtests.cpp

示例5: main

int main(int argc, char *argv[])
{
    print_IP_Address();
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;
    PdfRenderer myPdfRenderer;

    server pdfServer(1234);

    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    engine.addImageProvider(QLatin1String("pdfrenderer"), &myPdfRenderer);

    QObject *root = engine.rootObjects()[0];
    //QObject *main_qml = root->findChild<QObject*>("main");

    QObject::connect(&pdfServer, SIGNAL(pdfReceived(QByteArray)), &myPdfRenderer, SLOT(savePDF(QByteArray)));
    QObject::connect(&pdfServer, SIGNAL(pdfPageChanged(int)), &myPdfRenderer, SLOT(slot_setPage(int)));
    QObject::connect(&myPdfRenderer, SIGNAL(setPage(QVariant)),root, SLOT(qml_setPage(QVariant)));

    qDebug() << "App gestartet";
    return app.exec();
}
开发者ID:BeckmaR,项目名称:EmbeddedMultimediaSS2016,代码行数:22,代码来源:main.cpp

示例6: main

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

  qmlRegisterType<Thumbnail>("windowing", 1, 0, "Thumbnail");
  qmlRegisterType<Window>("windowing", 1, 0, "Window");
  qmlRegisterType<WindowModel>("windowing", 1, 0, "WindowList");
  qmlRegisterType<DesktopActions>("windowing", 1, 0, "DesktopActions");
  qmlRegisterType<XBoxControllerItem>("windowing", 1, 0, "Controller");

  WindowModel* windowModel = new WindowModel();

  QQmlApplicationEngine engine;
  QVariant v;
  v.setValue(windowModel);
  engine.rootContext()->setContextProperty("windowList", v);

  engine.addImageProvider(QLatin1String("icons"), new WindowIconImageProvider);

  engine.load(QUrl(QStringLiteral("qrc:///main.qml")));

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

示例7: main


//.........这里部分代码省略.........
    commandManager.InjectDependency(&keywordsSuggestor);
    commandManager.InjectDependency(&settingsModel);
    commandManager.InjectDependency(&recentDirectorieModel);
    commandManager.InjectDependency(&spellCheckerService);
    commandManager.InjectDependency(&spellCheckSuggestionModel);
    commandManager.InjectDependency(&metadataSaverService);
    commandManager.InjectDependency(&telemetryService);
    commandManager.InjectDependency(&updateService);
    commandManager.InjectDependency(&logsModel);
    commandManager.InjectDependency(&localLibrary);
    commandManager.InjectDependency(&metadataIOCoordinator);
    commandManager.InjectDependency(&pluginManager);
    commandManager.InjectDependency(&languagesModel);
    commandManager.InjectDependency(&colorsModel);
    commandManager.InjectDependency(&autoCompleteService);
    commandManager.InjectDependency(&imageCachingService);
    commandManager.InjectDependency(&replaceModel);
    commandManager.InjectDependency(&deleteKeywordsModel);
    commandManager.InjectDependency(&helpersQmlWrapper);

    commandManager.ensureDependenciesInjected();

    keywordsSuggestor.initSuggestionEngines();

    // other initializations
    secretsManager.setMasterPasswordHash(appSettings.value(Constants::MASTER_PASSWORD_HASH, "").toString());
    uploadInfoRepository.initFromString(appSettings.value(Constants::UPLOAD_HOSTS, "").toString());
    recentDirectorieModel.deserializeFromSettings(appSettings.value(Constants::RECENT_DIRECTORIES, "").toString());

    commandManager.connectEntitiesSignalsSlots();

    languagesModel.initFirstLanguage();
    languagesModel.loadLanguages();

    telemetryService.setInterfaceLanguage(languagesModel.getCurrentLanguage());

    qmlRegisterType<Helpers::ClipboardHelper>("xpiks", 1, 0, "ClipboardHelper");
    qmlRegisterType<QMLExtensions::TriangleElement>("xpiks", 1, 0, "TriangleElement");

    QQmlApplicationEngine engine;
    Helpers::GlobalImageProvider *globalProvider = new Helpers::GlobalImageProvider(QQmlImageProviderBase::Image);
    QMLExtensions::CachingImageProvider *cachingProvider = new QMLExtensions::CachingImageProvider(QQmlImageProviderBase::Image);
    cachingProvider->setImageCachingService(&imageCachingService);

    QQmlContext *rootContext = engine.rootContext();
    rootContext->setContextProperty("artItemsModel", &artItemsModel);
    rootContext->setContextProperty("artworkRepository", &artworkRepository);
    rootContext->setContextProperty("combinedArtworks", &combinedArtworksModel);
    rootContext->setContextProperty("appSettings", &appSettings);
    rootContext->setContextProperty("secretsManager", &secretsManager);
    rootContext->setContextProperty("undoRedoManager", &undoRedoManager);
    rootContext->setContextProperty("keywordsSuggestor", &keywordsSuggestor);
    rootContext->setContextProperty("settingsModel", &settingsModel);
    rootContext->setContextProperty("filteredArtItemsModel", &filteredArtItemsModel);
    rootContext->setContextProperty("helpersWrapper", &helpersQmlWrapper);
    rootContext->setContextProperty("recentDirectories", &recentDirectorieModel);
    rootContext->setContextProperty("metadataIOCoordinator", &metadataIOCoordinator);
    rootContext->setContextProperty("pluginManager", &pluginManager);
    rootContext->setContextProperty("pluginsWithActions", &pluginsWithActions);
    rootContext->setContextProperty("warningsModel", &warningsModel);
    rootContext->setContextProperty("languagesModel", &languagesModel);
    rootContext->setContextProperty("i18", &languagesModel);
    rootContext->setContextProperty("Colors", &colorsModel);
    rootContext->setContextProperty("acSource", &autoCompleteModel);
    rootContext->setContextProperty("replaceModel", &replaceModel);

#ifdef QT_DEBUG
    QVariant isDebug(true);
#else
    QVariant isDebug(false);
#endif
    rootContext->setContextProperty("debug", isDebug);

    engine.addImageProvider("global", globalProvider);
    engine.addImageProvider("cached", cachingProvider);

    LOG_DEBUG << "About to load main view...";
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    LOG_DEBUG << "Main view loaded";

    pluginManager.getUIProvider()->setQmlEngine(&engine);
    QQuickWindow *window = qobject_cast<QQuickWindow *>(engine.rootObjects().at(0));
    pluginManager.getUIProvider()->setRoot(window->contentItem());

#ifdef QT_DEBUG
    if (argc > 1) {
        QList<QUrl> pathes;
        for (int i = 1; i < argc; ++i) {
            pathes.append(QUrl::fromLocalFile(QString::fromUtf8(argv[i])));
        }

        commandManager.addInitialArtworks(pathes);
    }

#endif

    commandManager.afterConstructionCallback();

    return app.exec();
}
开发者ID:Artiom-M,项目名称:xpiks,代码行数:101,代码来源:main.cpp


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