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


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

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


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

示例1: main

int main(int argc, char *argv[])
{
    std::cout << "Have " << argc << " arguments:" << std::endl;
    for (int i = 0; i < argc; ++i) {
        std::cout << argv[i] << std::endl;
    }

    Client c;
    if (argc > 1) {
	c.doConnect();
    }

    QGuiApplication a(argc, argv);
    QQuickView view;

    QRCodeReader reader;
    view.engine()->rootContext()->setContextProperty("qrCodeReader", &reader);

    qmlRegisterType<QRCodeGenerator>("Tagger", 0, 1, "QRCodeGenerator");

    view.engine()->addImageProvider(QStringLiteral("qrcode"), new QRCodeImageProvider);
    view.engine()->addImageProvider(QStringLiteral("reader"), &reader);

    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource(QUrl::fromLocalFile("qml/tagger.qml"));
    view.show();

    return a.exec();
}
开发者ID:pdxwebdev,项目名称:utim,代码行数:29,代码来源:main.cpp

示例2: main

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

   qmlRegisterType<QVTKFrameBufferObjectItem>("VtkQuick", 1, 0, "VtkRenderWindow");

   QQuickView view;
   view.setSource(QUrl("qrc:///main.qml"));
   QList<QVTKFrameBufferObjectItem*> vtkItems = view.rootObject()->findChildren<QVTKFrameBufferObjectItem*>();

   // For demonstration: Add a cone to the scene of each QVTKFrameBufferObjectItem
   Q_FOREACH(QVTKFrameBufferObjectItem *vtkItem, vtkItems)
   {
      vtkGenericOpenGLRenderWindow *r_win = vtkItem->GetRenderWindow();

      vtkSmartPointer<vtkConeSource> cone = vtkSmartPointer<vtkConeSource>::New();
      //cone->SetHeight(3.0);
      //cone->SetRadius(1.0);
      cone->SetResolution(100);

      vtkSmartPointer<vtkPolyDataMapper> coneMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
      coneMapper->SetInputConnection(cone->GetOutputPort());

      vtkSmartPointer<vtkActor> coneActor = vtkSmartPointer<vtkActor>::New();
      coneActor->SetMapper(coneMapper);

      vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();
      ren1->AddActor(coneActor);

      r_win->AddRenderer(ren1);
   }
开发者ID:the-max0r,项目名称:VtkFboInQtQuickTemplate,代码行数:31,代码来源:main.cpp

示例3: run

void ZLibrary::run(ZLApplication* aApp)
{
    if (ZLLanguageUtil::isRTLLanguage(ZLibrary::Language())) {
        qApp->setLayoutDirection(Qt::RightToLeft);
    }

    QString qml(QString::fromStdString(BaseDirectory + BOOKS_QML_FILE));
    HDEBUG("qml file" << qPrintable(qml));

    QQuickView* view = SailfishApp::createView();
    QQmlContext* root = view->rootContext();
    QSize screenSize(view->screen()->size());
    booksPPI =
#if defined(__i386__)
        (screenSize == QSize(1536,2048)) ? 330 : 300;
#elif defined(__arm__)
        (screenSize == QSize(540,960)) ? 245 : 290;
#else
#  error Unexpected architechture
#endif
    HDEBUG("screen" << screenSize << booksPPI << "dpi");
    root->setContextProperty("PointsPerInch", booksPPI);
    root->setContextProperty("MaximumHintCount", 1);

    view->setTitle(qtTrId("books-app-name"));
    view->setSource(QUrl::fromLocalFile(qml));
    view->show();
    HDEBUG("started");
    qApp->exec();
    HDEBUG("exiting...");
}
开发者ID:rabauke,项目名称:harbour-books,代码行数:31,代码来源:ZLibrary.cpp

示例4: main

int main(int argc, char *argv[])
{
    // SailfishApp::main() will display "qml/template.qml", if you need more
    // control over initialization, you can use:
    //
    //   - SailfishApp::application(int, char *[]) to get the QGuiApplication *
    //   - SailfishApp::createView() to get a new QQuickView * instance
    //   - SailfishApp::pathTo(QString) to get a QUrl to a resource file
    //
    // To display the view, call "show()" (will show fullscreen on device).
    QCoreApplication::setOrganizationName("org");
    QCoreApplication::setOrganizationDomain("Sparkeyy");
    QCoreApplication::setApplicationName("harbour-spritradar");
    qmlRegisterType<Settings>("harbour.spritradar.Settings", 1,0, "Settings");

    QGuiApplication* app = SailfishApp::application(argc, argv);

    QQuickView* view = SailfishApp::createView();
    QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit()));
    view->rootContext()->setContextProperty("tankerkoenig_apikey", TANKERKOENIG_APIKEY); //Claim here: https://creativecommons.tankerkoenig.de/#register
    // has to be set as additional qmake argument to the project configuration (armv7hl, i486 and debug/release for both), like this: "TANKERKOENIG_APIKEY=<your_apikey>"
    view->setSource(SailfishApp::pathTo("qml/harbour-spritradar.qml"));
    view->show();

    return app->exec();
}
开发者ID:Armadill0,项目名称:harbour-spritradar,代码行数:26,代码来源:harbour-spritradar.cpp

示例5: main

int main(int argc, char* argv[])
{
   QGuiApplication app(argc,argv);
   qmlRegisterType<Connector>("Connector", 1, 0, "Connector");
   app.setOrganizationName("QtProject");\
   app.setOrganizationDomain("qt-project.org");\
   app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\
   QQuickView view;\
   if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\
       QSurfaceFormat f = view.format();\
       f.setProfile(QSurfaceFormat::CoreProfile);\
       f.setVersion(4, 4);\
       view.setFormat(f);\
   }\
   view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\
   new QQmlFileSelector(view.engine(), &view);\
   view.setSource(QUrl("qrc:///demos/tweetsearch/tweetsearch.qml")); \
   view.setResizeMode(QQuickView::SizeRootObjectToView);\
   if (QGuiApplication::platformName() == QLatin1String("qnx") || \
         QGuiApplication::platformName() == QLatin1String("eglfs")) {\
       view.showFullScreen();\
   } else {\
       view.show();\
   }\
   return app.exec();\
}
开发者ID:ernesto341,项目名称:FFA_App,代码行数:26,代码来源:main.cpp

示例6: nested

void tst_qquickfocusscope::nested()
{
    QQuickView *view = new QQuickView;
    view->setSource(testFileUrl("test2.qml"));

    QQuickFocusScope *item1 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item1"));
    QQuickFocusScope *item2 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item2"));
    QQuickFocusScope *item3 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item3"));
    QQuickFocusScope *item4 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item4"));
    QQuickFocusScope *item5 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item5"));
    QVERIFY(item1 != 0);
    QVERIFY(item2 != 0);
    QVERIFY(item3 != 0);
    QVERIFY(item4 != 0);
    QVERIFY(item5 != 0);

    view->show();
    view->requestActivate();

    QTest::qWaitForWindowActive(view);
    QTRY_VERIFY(view == qGuiApp->focusWindow());

    QVERIFY(item1->hasActiveFocus() == true);
    QVERIFY(item2->hasActiveFocus() == true);
    QVERIFY(item3->hasActiveFocus() == true);
    QVERIFY(item4->hasActiveFocus() == true);
    QVERIFY(item5->hasActiveFocus() == true);
    delete view;
}
开发者ID:ghjinlei,项目名称:qt5,代码行数:29,代码来源:tst_qquickfocusscope.cpp

示例7: main

int main(int argc, char **argv)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    QGuiApplication app(argc, argv);
#else
    QApplication app(argc, argv);
#endif

    app.setProperty("NoMStyle", QVariant(true));

    QDir::setCurrent(app.applicationDirPath());

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    QQuickView window;
#else
    QDeclarativeView window;
#endif
    window.setSource(QUrl("qrc:/main.qml"));
#ifdef __arm__
    window.showFullScreen();
#else
    window.show();
#endif

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

示例8: main

int main(int argc, char *argv[])
{
    // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
    QApplication app(argc, argv);

    QQuickView viewer;
    // The following are needed to make examples run without having to install the module
    // in desktop environments.
#ifdef Q_OS_WIN
    QString extraImportPath(QStringLiteral("%1/../../../../%2"));
#else
    QString extraImportPath(QStringLiteral("%1/../../../%2"));
#endif
    viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
                                      QString::fromLatin1("qml")));
    QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);

    QString appKey;
    if (argc > 1) {
        appKey = argv[1];
        qDebug() << "App key for worldweatheronline.com:" << appKey;
    } else {
        qWarning() << "No app key for worldweatheronline.com given. Using static test data instead of live data.";
    }
    viewer.setTitle(QStringLiteral("QML Weather"));
    viewer.rootContext()->setContextProperty("weatherAppKey", appKey);
    viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml"));
    viewer.setResizeMode(QQuickView::SizeRootObjectToView);
    viewer.show();

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

示例9: main

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

    FileTest *fileTest = new FileTest();
    fileTest->writeFilesToDisk();
    fileTest->readFilesFromDisk();

    NetworkTest *networkTest = new NetworkTest();
    networkTest->TestHttp();
    networkTest->TestHttps();

    QQuickView view;

    GpsClient *gpsClient = new GpsClient(&view);
    view.engine()->rootContext()->setContextProperty(QLatin1String("gpsClient"),
                                                     gpsClient);

    NotificationClient *notificationClient = new NotificationClient(&view);
    view.engine()->rootContext()->setContextProperty(QLatin1String("notificationClient"),
                                                     notificationClient);
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource(QUrl(QStringLiteral("qrc:/qml/main.qml")));

    view.show();

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

示例10: main

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

  QQuickView viewer;
  viewer.setResizeMode(QQuickView::SizeRootObjectToView);

  QObjectList model_qobjectlist;
  model_qobjectlist << new TestObject(0);
  model_qobjectlist << new TestObject(1);
  model_qobjectlist << new TestObject(2);
  viewer.rootContext()->setContextProperty("model_qobjectlist", QVariant::fromValue(model_qobjectlist));

  TestObject *model_qobject = new TestObject(0);
  viewer.rootContext()->setContextProperty("model_qobject", QVariant::fromValue(model_qobject));

  QStringList model_qstringlist;
  model_qstringlist << QStringLiteral("A");
  model_qstringlist << QStringLiteral("B");
  model_qstringlist << QStringLiteral("C");
  viewer.rootContext()->setContextProperty("model_qstringlist", model_qstringlist);

  TestModel *model_qaim = new TestModel;
  viewer.rootContext()->setContextProperty("model_qaim", model_qaim);

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

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

示例11: main

int main(int argc, char *argv[])
{
    //start appliacation
    QGuiApplication a(argc, argv);
    //settings
    CQmlSettings settings(QCoreApplication::applicationDirPath() + "/qmlConfigure.xml");
    if(settings.errorMap.count() > 0)
        exit(0);

    DVRSettings dvrSetting;
    dvrSetting.IP = settings.node("IP");
    dvrSetting.server_port = settings.node("serverPort").toInt();

    //事物层对象初始化
    CTransaction transaction;

    //初始化clientThread
    ClientThread receiveDataThread(&transaction, dvrSetting);
    receiveDataThread.start();
    QQuickView view;
    view.rootContext()->setContextProperty("transaction", &transaction);
    view.rootContext()->setContextProperty("settings", &settings);
    view.rootContext()->setContextProperty("mainWindow", &view);
    view.setSource(QUrl("qrc:/robo/qml/hitRobotGroup/MainPage.qml"));
    view.show();

    return a.exec();


}
开发者ID:YeChenzjg,项目名称:qt_HRG_robot_check,代码行数:30,代码来源:main.cpp

示例12: main

/*------------------------------------------------------------------------------
|    main
+-----------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
	QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
	QApplication a(argc, argv);

	QStringList args = a.arguments();
	const bool opengl = !args.contains("--no-opengl");
	args.removeAll("--no-opengl");

	if (opengl) {
		qDebug("QML QtWebEngine...");

		QQuickView* view = new QQuickView;
		view->setSource(QUrl("qrc:/poc_main.qml"));
		view->showFullScreen();

		QObject* o = view->rootObject()->findChild<QObject*>("webEngineView");
		o->setProperty("url", args.at(1));
	}
	else {
		qDebug("Widget QtWebEngine...");

		QWebEngineView* view = new QWebEngineView;
		view->load(QUrl(args.at(1)));
		view->show();
	}

	return a.exec();
}
开发者ID:carlonluca,项目名称:pi,代码行数:32,代码来源:main.cpp

示例13: main

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

  //QString extraImportPath(QStringLiteral("%1/../../../%2"));
  //viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), QString::fromLatin1("qml")));

  // set path to find the plugin
  QString extraImportPath(QStringLiteral("%1/../pluginlib"));
  QString path = extraImportPath.arg(QGuiApplication::applicationDirPath());
  viewer.engine()->addImportPath(path);

  // create list of my custom objects
  Wrapper wrapper;

  // and set the list as model
  QQmlContext *ctxt = viewer.rootContext();
  ctxt->setContextProperty("wrapper", &wrapper);

  // set up connection
  QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
  viewer.setTitle(QStringLiteral("Custom Plugin Demo"));

  viewer.setResizeMode(QQuickView::SizeRootObjectToView);
  viewer.setSource(QUrl("qrc:/qml/view.qml"));
  viewer.show();

  return QGuiApplication::exec();
}
开发者ID:cvilas,项目名称:scratch,代码行数:32,代码来源:main.cpp

示例14: QMainWindow

MsmWindow::MsmWindow(QWidget *parent) :
    QMainWindow(parent)
{
    // Prepare the view area
    stackedWidget = new QStackedWidget(this);
    setCentralWidget(stackedWidget);

    QQuickView *view = new QQuickView();
    menuView = QWidget::createWindowContainer(view, this);
    menuView->setFocusPolicy(Qt::TabFocus);
    view->setSource(QUrl("qrc:/qml/main.qml"));
    stackedWidget->addWidget(menuView);
    stackedWidget->setCurrentWidget(menuView);

    moduleView = new ModuleView();
    stackedWidget->addWidget(moduleView);

    QQuickItem *rootObject = view->rootObject();
    QQuickItem::connect(rootObject, SIGNAL(itemClicked(QString)),
                     this, SLOT(loadModule(QString)));

    ModuleView::connect(moduleView, &ModuleView::closeRequest,
                        [=]() {
        moduleView->resolveChanges();
        moduleView->closeModules();
        stackedWidget->setCurrentWidget(menuView);
    });

    init();
    readPositionSettings();
}
开发者ID:archcidburnziso,项目名称:manjaro-settings-manager,代码行数:31,代码来源:MsmWindow.cpp

示例15: testProperties

void tst_QQuickGraphicsInfo::testProperties()
{
    QQuickView view;
    view.setSource(QUrl("data/basic.qml"));

    view.show();
    QVERIFY(QTest::qWaitForWindowExposed(&view));

    QSignalSpy spy(&view, SIGNAL(sceneGraphInitialized()));
    spy.wait();

    QObject* obj = view.rootObject();
    QVERIFY(obj);

    QSGRendererInterface *rif = view.rendererInterface();
    const int expectedAPI = rif ? rif->graphicsApi() : QSGRendererInterface::Unknown;

    QCOMPARE(obj->property("api").toInt(), expectedAPI);

#if QT_CONFIG(opengl)
    if (expectedAPI == QSGRendererInterface::OpenGL) {
        QCOMPARE(obj->property("shaderType").toInt(), int(QSGRendererInterface::GLSL));
        QVERIFY(view.openglContext());
        QSurfaceFormat format = view.openglContext()->format();
        QCOMPARE(obj->property("majorVersion").toInt(), format.majorVersion());
        QCOMPARE(obj->property("minorVersion").toInt(), format.minorVersion());
        QCOMPARE(obj->property("profile").toInt(), static_cast<int>(format.profile()));
        QCOMPARE(obj->property("renderableType").toInt(), static_cast<int>(format.renderableType()));
    }
#endif
}
开发者ID:,项目名称:,代码行数:31,代码来源:


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