예제 #1
0
파일: main.cpp 프로젝트: ernesto341/FFA_App
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();\
}
예제 #2
0
파일: main.cpp 프로젝트: TanNgocDo/sysviz
int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);

//    qmlRegisterType<TraceView>("SysViz", 1, 0, "TraceView");
    qmlRegisterType<ThreadSliceView>("SysViz", 1, 0, "ThreadSliceView");
    qmlRegisterType<GraphItem>      ("SysViz", 1, 0, "GraphItem");
    qmlRegisterType<TraceModel>();
    qmlRegisterType<QAbstractListModel>();
    qmlRegisterType<CpuFrequencyModel>();
    qmlRegisterType<GpuFrequencyModel>();

    TraceModel model;

    QQuickView view;
    QSurfaceFormat format = view.requestedFormat();
    format.setSamples(16);
    view.setFormat(format);

    view.rootContext()->setContextProperty("traceModel", &model);
    view.rootContext()->setContextProperty("cm", view.screen()->physicalDotsPerInch() / 2.54);

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

#ifdef QT_DQML_LIB
    DQmlLocalServer server(view.engine(), &view, "qml/main.qml");
    server.fileTracker()->track("qml", "qml");
#endif

    app.exec();
}
예제 #3
0
void MainWindow::updateView()
{
    QSurfaceFormat format;
    format.setDepthBufferSize(16);
    format.setStencilBufferSize(8);
    if (m_transparent)
        format.setAlphaBufferSize(8);
    if (m_checkboxMultiSample->isChecked())
        format.setSamples(4);

    State state = m_radioView->isChecked() ? UseWindow : UseWidget;

    if (m_format == format && m_state == state)
        return;

    m_format = format;
    m_state = state;

    QString text = m_currentRootObject
            ? m_currentRootObject->property("currentText").toString()
            : QStringLiteral("Hello Qt");

    QUrl source("qrc:qquickviewcomparison/test.qml");

    if (m_state == UseWindow) {
        QQuickView *quickView = new QQuickView;
        // m_transparent is not supported here since many systems have problems with semi-transparent child windows
        quickView->setFormat(m_format);
        quickView->setResizeMode(QQuickView::SizeRootObjectToView);
        connect(quickView, &QQuickView::statusChanged, this, &MainWindow::onStatusChangedView);
        connect(quickView, &QQuickView::sceneGraphError, this, &MainWindow::onSceneGraphError);
        quickView->setSource(source);
        m_currentRootObject = quickView->rootObject();
        switchTo(QWidget::createWindowContainer(quickView));
    } else if (m_state == UseWidget) {
        QQuickWidget *quickWidget = new QQuickWidget;
        if (m_transparent) {
            quickWidget->setClearColor(Qt::transparent);
            quickWidget->setAttribute(Qt::WA_TranslucentBackground);
        }
        quickWidget->setFormat(m_format);
        quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
        connect(quickWidget, &QQuickWidget::statusChanged, this, &MainWindow::onStatusChangedWidget);
        connect(quickWidget, &QQuickWidget::sceneGraphError, this, &MainWindow::onSceneGraphError);
        quickWidget->setSource(source);
        m_currentRootObject = quickWidget->rootObject();
        switchTo(quickWidget);
    }

    if (m_currentRootObject) {
        m_currentRootObject->setProperty("currentText", text);
        m_currentRootObject->setProperty("multisample", m_checkboxMultiSample->isChecked());
        m_currentRootObject->setProperty("translucency", m_transparent);
    }

    m_overlayLabel->raise();
}
예제 #4
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();
}
예제 #5
0
파일: main.cpp 프로젝트: 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();
}
예제 #6
0
파일: main.cpp 프로젝트: RSATom/Qt
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QSurfaceFormat format;
    if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
        format.setVersion(3, 2);
        format.setProfile(QSurfaceFormat::CoreProfile);
    }
    format.setDepthBufferSize(24);
    format.setStencilBufferSize(8);
    format.setSamples(4);

    QQuickView view;
    view.setFormat(format);
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource(QUrl("qrc:/main.qml"));
    view.setColor("#000000");
    view.show();

    return app.exec();
}
예제 #7
0
파일: main.cpp 프로젝트: jjpress/tensor
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();
}
예제 #8
0
파일: main.cpp 프로젝트: bgbadchrs/pi
/*----------------------------------------------------------------------
|    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();
}