Example #1
0
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();\
}
Example #2
0
//! [1]
int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);

    qmlRegisterType<BezierCurve>("CustomGeometry", 1, 0, "BezierCurve");

    QQuickView view;
    QSurfaceFormat format = view.format();
    format.setSamples(16);
    view.setFormat(format);
    view.setSource(QUrl("qrc:///scenegraph/customgeometry/main.qml"));
    view.show();

    app.exec();
}
Example #3
0
File: main.cpp Project: wfay/qtst
int main(int argc, char* argv[])
{
    pthread_t trade_thread, md_thread;
    QGuiApplication app(argc,argv);
    qmlRegisterType<Graph>("Graph", 1, 0, "Graph");
    app.setOrganizationName("QtProject");
    app.setOrganizationDomain("qt-project.org");
    app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());
    QQmlEngine engine;
    QQmlComponent component(&engine, QUrl("qrc:///demos/stocqt/content/Tradepanel.qml"));
 //   if( component.status != component.Ready )
 //   {
 //       if( component.status == component.Error )
 //           console.debug("Error:"+ component.errorString() );
 //       return; // or maybe throw
 //   }

    object = component.create();

    QQuickView view;
    tradepanel.object=object;
    PublicFuncs tradeFun(object);
    view.rootContext()->setContextProperty("myObject", &tradepanel);
    view.rootContext()->setContextProperty("myObject_t", &tradeFun);
    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/stocqt/stocqt.qml"));
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    if (QGuiApplication::platformName() == QLatin1String("qnx") ||
          QGuiApplication::platformName() == QLatin1String("eglfs")) {
        view.showFullScreen();
    } else {
        view.show();
    }

    pthread_create(&md_thread, NULL, Msclient, NULL);
    pthread_create(&trade_thread, NULL, trade_main, NULL);

    return app.exec();
}
Example #4
0
int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);

    if (!QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ThreadedOpenGL)) {
        QQuickView view;
        view.setSource(QUrl("qrc:///scenegraph/textureinthread/error.qml"));
        view.show();
        return app.exec();
    }

    qmlRegisterType<ThreadRenderer>("SceneGraphRendering", 1, 0, "Renderer");
    int execReturn = 0;

    {
        QQuickView view;

        // Rendering in a thread introduces a slightly more complicated cleanup
        // so we ensure that no cleanup of graphics resources happen until the
        // application is shutting down.
        view.setPersistentOpenGLContext(true);
        view.setPersistentSceneGraph(true);

        setContext(view);
        qDebug() << "\n*** QSurfaceFormat from window surface ***";
        printFormat(view.format());

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

        execReturn = app.exec();
    }

    // As the render threads make use of our QGuiApplication object
    // to clean up gracefully, wait for them to finish before
    // QGuiApp is taken off the heap.
    foreach (QThread *t, ThreadRenderer::threads) {
        t->wait();
        delete t;
    }
Example #5
0
int main(int argc, char *argv[]) {
    QGuiApplication app(argc,argv);
    app.setOrganizationName("David A Roberts");
    app.setOrganizationDomain("davidar.io");
    app.setApplicationName("Tensor");
    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:///src/Tensor.qml"));
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    if(QGuiApplication::platformName() == QLatin1String("qnx") ||
       QGuiApplication::platformName() == QLatin1String("eglfs")) {
        view.showFullScreen();
    } else {
        view.show();
    }
    return app.exec();
}
Example #6
0
/*----------------------------------------------------------------------
|    main
+---------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
	QGuiApplication app(argc, argv);

	// Utility.
	QStringList args = app.arguments();
	POC_Mode currentMode;
	if (args.contains("--animations"))
		currentMode = MODE_ANIMATIONS;
	else if (args.contains("--loop"))
		currentMode = MODE_LOOP;
	else if (args.contains("--seektest"))
		currentMode = MODE_SEEK;
	else
		currentMode = MODE_PLAYER;

	POC_QMLUtils qmlUtils;

	QQuickView view;

	// Set EGL to 24bit color depth.
	QSurfaceFormat curSurface = view.format();
	curSurface.setRedBufferSize(8);
	curSurface.setGreenBufferSize(8);
	curSurface.setBlueBufferSize(8);
	curSurface.setAlphaBufferSize(0);
	view.setFormat(curSurface);

	view.engine()->rootContext()->setContextProperty("utils", &qmlUtils);
	switch (currentMode) {
	case MODE_ANIMATIONS:
		view.setSource(QUrl("qrc:///qml/main_animations.qml"));
		break;
	case MODE_LOOP:
		view.setSource(QUrl("qrc:///qml/main_loop.qml"));
		break;
	case MODE_SEEK:
		view.setSource(QUrl(QStringLiteral("qrc:///qml/main_seektest.qml")));
		break;
	default:
		view.setSource(QUrl("qrc:///qml/main.qml"));
		break;
	}

	qInstallMessageHandler(&log_handler);
	LC_QMLLogger::registerObject(view.rootContext());

	view.setResizeMode(QQuickView::SizeRootObjectToView);
#ifdef RASPBERRY
	view.showFullScreen();
#else
	view.resize(800, 400);
	view.show();
#endif // RASPBERRY
	qApp->connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));

	// If file path is provided from the command line, I start the player
	// immediately.
	switch (currentMode) {
	case MODE_LOOP: {
		QStringList list;
		for (int i = 2; i < args.size(); i++)
			list << args.at(i);
		if (list.size() < 1)
			return log_warn("No items to play.");
      if (!show_media(&view, list))
			return 1;
		break;
	}
	case MODE_PLAYER:
		if (args.size() > 1)
			if (!show_media(&view, args.at(1)))
				return 1;
		break;
	default:
		if (args.size() > 2)
			if (!show_media(&view, args.at(2)))
				return 1;
		break;
	}

	return app.exec();
}