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

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

    viewer.setTitle(QStringLiteral("Interaction"));
    viewer.setResizeMode(QQuickView::SizeRootObjectToView);
    viewer.setColor("#fafafa");
    viewer.show();

    return app.exec();
}
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

#ifdef Q_OS_WIN
    // Force usage of OpenGL ES through ANGLE on Windows
    QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif

    // Register the map view for QML
    qmlRegisterType<MapQuickView>("Esri.Samples", 1, 0, "MapView");
    qmlRegisterType<SetInitialMapArea>("Esri.Samples", 1, 0, "SetInitialMapAreaSample");

    // Intialize application view
    QQuickView view;
    view.setResizeMode(QQuickView::SizeRootObjectToView);

    // Add the import Path
    view.engine()->addImportPath(QDir(QCoreApplication::applicationDirPath()).filePath("qml"));

    // Set the source
    view.setSource(QUrl("qrc:/Samples/Maps/SetInitialMapArea/SetInitialMapArea.qml"));

    view.show();

    return app.exec();
}
Example #4
0
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();
}
Example #5
0
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();
}
Example #6
0
Q_DECL_EXPORT int main(int argc, char *argv[]) {
	QGuiApplication *lApplication = new QGuiApplication(argc, argv);
	QQuickView *lView = new QQuickView;
	lView->setResizeMode(QQuickView::SizeRootObjectToView);

	QVariantList lLevelList;
	createAllLevels(lLevelList);
	lView->rootContext()->setContextProperty(QStringLiteral("gLevels"), lLevelList);

	QNetworkAccessManager lNetworkManager;
	LevelModel *lLevelModel = new LevelModel(lLevelList.count(), &lNetworkManager, lApplication);
	lView->rootContext()->setContextProperty(QStringLiteral("gLevelModel"), lLevelModel);

	HighScoresModel *lHighScoresModel = new HighScoresModel(lApplication);
	lView->rootContext()->setContextProperty(QStringLiteral("gHighScoresModel"), lHighScoresModel);

	QObject::connect(lLevelModel, SIGNAL(postingSucceded()), lHighScoresModel, SLOT(readScoresFromFile()));
	QObject::connect(lView->engine(), SIGNAL(quit()), lApplication, SLOT(quit()));

	qmlRegisterType<LevelHighScoresModel>("ChimpModels", 1, 0, "LevelHighScoreModel");
	LevelHighScoresModel::registerOtherModels(lLevelModel, lHighScoresModel);

	lView->setSource(QStringLiteral("qrc:///qml/Game.qml"));
	lView->showFullScreen();

	return lApplication->exec();
}
Example #7
0
void Fix8Log::aboutSlot()
{

    QDialog *aboutDialog = new QDialog();
    QVBoxLayout *aboutLayout = new QVBoxLayout(0);

    QDialogButtonBox *dialogButtonBox = new QDialogButtonBox();

    dialogButtonBox->addButton(QDialogButtonBox::Ok);
    connect(dialogButtonBox,SIGNAL(clicked(QAbstractButton*)),
            aboutDialog,SLOT(close()));

    QQuickView *aboutView = new QQuickView(QUrl("qrc:qml/helpAbout.qml"));
    QQuickItem *qmlObject = aboutView->rootObject();
    qmlObject->setProperty("color",aboutDialog->palette().color(QPalette::Window));
    qmlObject->setProperty("bgColor",aboutDialog->palette().color(QPalette::Window));
    qmlObject->setProperty("version",QString::number(Globals::version));

    aboutView->setResizeMode(QQuickView::SizeRootObjectToView);

    QWidget *aboutWidget = QWidget::createWindowContainer(aboutView,0);
    aboutWidget->setPalette(aboutDialog->palette());
    aboutWidget->setAutoFillBackground(false);
    aboutDialog->setLayout(aboutLayout);

    aboutLayout->addWidget(aboutWidget,1);
    aboutLayout->addWidget(dialogButtonBox,0);
    aboutDialog->resize(500,400);
    aboutDialog->setWindowTitle(GUI::Globals::appName);
    aboutDialog->exec();
    aboutDialog->deleteLater();

}
Example #8
0
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();
}
Example #9
0
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();
}
Example #10
0
//=====================================================================================================================
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();
}
Example #11
0
int main(int argc, char *argv[])
{
    //! [0]
    // Uncomment to turn on all the logging categories of Canvas3D
//    QString loggingFilter = QString("qt.canvas3d.info.debug=true\n");
//    loggingFilter += QStringLiteral("qt.canvas3d.rendering.debug=true\n")
//            + QStringLiteral("qt.canvas3d.rendering.warning=true\n")
//            + QStringLiteral("qt.canvas3d.glerrors.debug=true");
//    QLoggingCategory::setFilterRules(loggingFilter);
    //! [0]

    QGuiApplication 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")));

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

    viewer.setTitle(QStringLiteral("Textured and Lit Cube"));
    viewer.setResizeMode(QQuickView::SizeRootObjectToView);
    viewer.setColor("#fafafa");
    viewer.show();

    return app.exec();
}
FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogManager) :
    QDialog(parent)
{
    qmlRegisterType<ExtendedDebugLogEntry>("org.openpilot", 1, 0, "DebugLogEntry");
    qmlRegisterType<UAVOLogSettingsWrapper>("org.openpilot", 1, 0, "UAVOLogSettingsWrapper");

    setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
    setWindowTitle(tr("Manage flight side logs"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setMinimumSize(600, 400);

    QQuickView *view = new QQuickView();
    view->rootContext()->setContextProperty("dialog", this);
    view->rootContext()->setContextProperty("logStatus", flightLogManager->flightLogStatus());
    view->rootContext()->setContextProperty("logControl", flightLogManager->flightLogControl());
    view->rootContext()->setContextProperty("logSettings", flightLogManager->flightLogSettings());
    view->rootContext()->setContextProperty("logManager", flightLogManager);
    view->setResizeMode(QQuickView::SizeRootObjectToView);
    view->setSource(QUrl("qrc:/flightlog/FlightLogDialog.qml"));

    QWidget *container = QWidget::createWindowContainer(view);
    container->setMinimumSize(600, 400);
    container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    QVBoxLayout *lay   = new QVBoxLayout();
    lay->setContentsMargins(0, 0, 0, 0);
    setLayout(lay);
    layout()->addWidget(container);
}
Example #13
0
int main(int argc, char** argv)
{

    QCoreApplication::setOrganizationName("com.ubuntu.developer.mzanetti.kodimote");
    QCoreApplication::setApplicationName("kodimote");

    QGuiApplication application(argc, argv);

    // Load language file
    QString language = QLocale::system().bcp47Name();
    qDebug() << "got language:" << language;

    QTranslator qtTranslator;

    if(!qtTranslator.load("qt_" + language, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
        qDebug() << "couldn't load qt_" + language;
    }
    application.installTranslator(&qtTranslator);

    QTranslator translator;
    if (!translator.load(":/kodimote_" + language + ".qm")) {
        qDebug() << "Cannot load translation file" << "kodimote_" + language + ".pm";
    }
    application.installTranslator(&translator);


    Kodi::instance()->setDataPath(QDir::homePath() + "/.cache/com.ubuntu.developer.mzanetti.kodimote/");
    Kodi::instance()->eventClient()->setApplicationThumbnail("kodimote80.png");

    QQuickView *view = new QQuickView();

    Settings settings;
    UbuntuHelper helper(view, &settings);

    ProtocolManager protocols;

    MprisController controller(&protocols, &helper);
    Q_UNUSED(controller)


    view->setResizeMode(QQuickView::SizeRootObjectToView);

    view->engine()->setNetworkAccessManagerFactory(new NetworkAccessManagerFactory());

    view->setTitle("Kodimote");
    view->engine()->rootContext()->setContextProperty("kodi", Kodi::instance());

    view->engine()->rootContext()->setContextProperty("settings", &settings);
    view->engine()->rootContext()->setContextProperty("protocolManager", &protocols);
    view->setSource(QUrl("qrc:///qml/main.qml"));

    if(QGuiApplication::arguments().contains("--fullscreen")) {
        view->showFullScreen();
    } else {
//        view->resize(QSize(720, 1280));
        view->show();
    }

    return application.exec();
}
Example #14
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 #15
0
int main(int argc, char *argv[])
{
    int ret;

    QGuiApplication app(argc, argv);

    QQuickView *pParentView = new QQuickView();

    pParentView->setResizeMode(QQuickView::SizeRootObjectToView);

    QQmlEngine *engine = pParentView->engine();
    qmlRegisterType<TestListModel>("TestListModel",1,0,"TestListModel");


#if 1
    QDir::setCurrent(QGuiApplication::applicationDirPath());
    QmcLoader loader(engine);
    QQmlComponent *component = loader.loadComponent("../qml/main.qmc");
#else
    QQmlComponent *component = new QQmlComponent(engine, QUrl("../qml/main.qmc"));
#endif

    if (!component) {
        qDebug() << "Could not load component";
        return -1;
    }

    if (!component->isReady()) {
        qDebug() << "Component is not ready";
        if (component->isError()) {
            foreach (const QQmlError &error, component->errors()) {
                qDebug() << error.toString();
            }
        }
Example #16
0
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);

    viewer.setTitle(QStringLiteral("QML Chart"));

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

    return app.exec();
}
Example #17
0
//![0]
int main(int argc, char ** argv)
{
    QGuiApplication app(argc, argv);

    QList<QObject*> dataList;
    dataList.append(new DataObject("Item 1", "red"));
    dataList.append(new DataObject("Item 2", "green"));
    dataList.append(new DataObject("Item 3", "blue"));
    dataList.append(new DataObject("Item 4", "yellow"));

    QQuickView view;

    view.setResizeMode(QQuickView::SizeRootObjectToView);
    QQmlContext *ctxt = view.rootContext();
//![0]

#if 1
    // add precompiled files
    QQmlEngine *engine = view.engine();
    QQmlEnginePrivate::get(engine)->v4engine()->iselFactory.reset(new QV4::JIT::ISelFactory);
    QmcLoader loader(engine);
    QQmlComponent *component = loader.loadComponent(":/view.qmc");
    if (!component) {
        qDebug() << "Could not load component";
        return -1;
    }
    if (!component->isReady()) {
        qDebug() << "Component is not ready";
        if (component->isError()) {
            foreach (const QQmlError &error, component->errors()) {
                qDebug() << error.toString();
            }
        }
Example #18
0
int main(int argc, char **argv)
{
	QGuiApplication *app = SailfishApp::application(argc, argv);
	
    qmlRegisterType<Mainview>("harbour.monav", 1, 0, "Mainview");
    qmlRegisterType<TapMenu>("harbour.monav", 1, 0, "TapMenu");
    qmlRegisterType<MapPackages>("harbour.monav", 1, 0, "MapPackages");
    qmlRegisterType<Bookmarks>("harbour.monav", 1, 0, "Bookmarks");
    qmlRegisterType<PaintWidget>("harbour.monav", 1, 0, "PaintWidget");
    qmlRegisterType<WorldMapChooser>("harbour.monav", 1, 0, "WorldMapChooser");

	QQuickView *view = SailfishApp::createView();
	view->setSource(SailfishApp::pathTo("qml/Main.qml"));
	view->show();
	view->setResizeMode(QQuickView::SizeRootObjectToView);
	QObject *object = (QObject *) view->rootObject();
	
	Mainview *mainview = object->findChild<Mainview *>("mainview");
	mainview->init();
	
	app->connect( app, SIGNAL(aboutToQuit()), MapData::instance(), SLOT(cleanup()) );
	app->connect( app, SIGNAL(aboutToQuit()), RoutingLogic::instance(), SLOT(cleanup()) );
	app->connect( app, SIGNAL(aboutToQuit()), Logger::instance(), SLOT(cleanup()) );
	
	app->connect( app, SIGNAL(aboutToQuit()), mainview, SLOT(cleanup()) );

	return app->exec();
}
Example #19
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    if (!QResource::registerResource("qmc_res3.rcc") ||
        !QResource::registerResource("qmc_res5.rcc"))
    {
        qDebug() << "Could not register resources.";
        return 1;
    }

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

    QQmlEngine *engine = view.engine();
    QmcLoader loader(engine);
    QQmlComponent *component = loader.loadComponent("qrc:/app.qmc");

    if (!component) {
        qDebug() << "Could not load component";
        return -1;
    }
    if (!component->isReady()) {
        qDebug() << "Component is not ready";
        if (component->isError()) {
            foreach (const QQmlError &error, component->errors()) {
                qDebug() << error.toString();
            }
        }
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

#ifdef Q_OS_WIN
    // Force usage of OpenGL ES through ANGLE on Windows
    QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif

    // Register the map view for QML
    qmlRegisterType<MapQuickView>("Esri.Samples", 1, 0, "MapView");
    qmlRegisterUncreatableType<ArcGISSublayerListModel>("Esri.Samples", 1, 0, "ArcGISSublayerListModel", "ArcGISSublayerListModel is an uncreatable type");
    qmlRegisterType<ChangeSublayerVisibility>("Esri.Samples", 1, 0, "ChangeSublayerVisibilitySample");

    // Intialize application view
    QQuickView view;
    view.setResizeMode(QQuickView::SizeRootObjectToView);

    // Add the import Path
    view.engine()->addImportPath(QDir(QCoreApplication::applicationDirPath()).filePath("qml"));

    // Set the source
    view.setSource(QUrl("qrc:/Samples/Layers/ChangeSublayerVisibility/ChangeSublayerVisibility.qml"));

    view.show();

    return app.exec();
}
Example #21
0
int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);
    qmlRegisterType<FileReader>("org.qtproject.testapi", 1, 0, "FileReader");

    QQuickView view;
    app.setOrganizationName("Acomb Methodist Church");
    app.setOrganizationDomain("amc.com");
    app.setApplicationName("Church Calendar");
    #ifdef Q_OS_ANDROID
    NotificationClient *notificationClient = new NotificationClient(&view);

    view.engine()->rootContext()->setContextProperty(QLatin1String("notificationClient"),
                                                      notificationClient);

#endif
    FileReader *fileReader = new FileReader(&view);

    view.engine()->rootContext()->setContextProperty(QLatin1String("fileReader"),
	fileReader);
    view.engine()->addImportPath("/usr/share/qml/");
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource(QUrl(QStringLiteral("qrc:/Views/Main.qml")));
    view.show();


    return app.exec();
}
Example #22
0
/*----------------------------------------------------------------------
|    definitions
+---------------------------------------------------------------------*/
int main(int argc, char *argv[])
{
#if 0
    signal(SIGSEGV, handlerSigsegv);
    signal(SIGINT, handlerSigint);
#endif

    QApplication a(argc, argv);

    // Registers all the codecs.
    av_register_all();

#ifdef ENABLE_CUBE_SAMPLE
    // Check arguments.
    if (argc < 3) {
        LOG_ERROR(LOG_TAG, "You have to provide a prefix for the textures to use and the path to the video.");
        LOG_ERROR(LOG_TAG, "You'll need 6 textures whose abs path is <prefix><n>.jpg with <n> in [0, 5].");
        LOG_ERROR(LOG_TAG, "Then start the application with <prefix> as the"
                  " first param and <video_path> as the second.");
        return -1;
    }

    // Check file existance.
    for (int i = 0; i < 6; i++) {
        QString filePath = QString("%1%2%3").arg(a.arguments().at(1)).arg(i).arg(".jpg");
        if (!QFile(filePath).exists()) {
            LOG_ERROR(LOG_TAG, "Couldn't find %s.", qPrintable(filePath));
            return -1;
        }
    }
    if (!QFile(a.arguments().at(2)).exists()) {
        LOG_ERROR(LOG_TAG, "Video file does not exist.");
        return -1;
    }

    // Build scene.
    GLWidget widget(a.arguments().at(1), a.arguments().at(2));
    widget.show();
#elif ENABLE_QML_SAMPLE
#ifdef ENABLE_VIDEO_TEST
    qRegisterMetaType<GLuint>("GLuint");
    qRegisterMetaType<OMX_TextureData*>("OMX_TextureData*");
    qmlRegisterType<OMX_ImageElement>("com.luke.qml", 1, 0, "OMXImage");
    qmlRegisterType<OMX_VideoSurfaceElement>("com.luke.qml", 1, 0, "OMXVideoSurface");
    qmlRegisterType<OMX_CameraSurfaceElement>("com.luke.qml", 1, 0, "OMXCameraSurface");
    qmlRegisterType<OMX_MediaProcessorElement>("com.luke.qml", 1, 0, "OMXMediaProcessor");

    QQuickView view;
    view.setSource(QUrl("qrc:///main.qml"));
    view.setResizeMode(view.SizeRootObjectToView);
    view.showFullScreen();
#else
    OMX_AudioProcessor proc;
    proc.play();
#endif // ENABLE_VIDEO_TEST
#endif // ENABLE_CUBE_SAMPLE
    return a.exec();
}
Example #23
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();
}
Example #24
0
int main(int argc, char *argv[])
{
    QGuiApplication application(argc, argv);
    QQuickView view;
    view.setSource(QUrl("qrc:/corkboards.qml"));
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.show();
    return application.exec();
}
Example #25
0
int main(int argc, char *argv[])
{
    // QLoggingCategory::setFilterRules(QLatin1String("*.debug=false"));

    qmlRegisterUncreatableType<qml::DataRepositoryObject>("harbour.twablet", 1, 0, "DataRepository", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::IModel>("harbour.twablet", 1, 0, "Model", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::AccountObject>("harbour.twablet", 1, 0, "Account", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::LayoutObject>("harbour.twablet", 1, 0, "Layout", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::QueryTypeObject>("harbour.twablet", 1, 0, "QueryType", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::TweetObject>("harbour.twablet", 1, 0, "Tweet", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::QuotedTweetObject>("harbour.twablet", 1, 0, "QuotedTweet", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::UserObject>("harbour.twablet", 1, 0, "User", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::MediaObject>("harbour.twablet", 1, 0, "Media", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::MediaModel>("harbour.twablet", 1, 0, "MediaModel", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<qml::IQueryItem>("harbour.twablet", 1, 0, "QueryItem", QLatin1String("Uncreatable"));
    qmlRegisterUncreatableType<Info>("harbour.twablet", 1, 0, "Info", QLatin1String("Uncreatable"));
    qmlRegisterType<qml::TwitterAuthentification>("harbour.twablet", 1, 0, "TwitterAuthentification");
    qmlRegisterType<qml::AccountModel>("harbour.twablet", 1, 0, "AccountModel");
    qmlRegisterType<qml::AccountSelectionModel>("harbour.twablet", 1, 0, "AccountSelectionModel");
    qmlRegisterType<qml::LayoutModel>("harbour.twablet", 1, 0, "LayoutModel");
    qmlRegisterType<qml::TweetModel>("harbour.twablet", 1, 0, "TweetModel");
    qmlRegisterType<qml::QueryTypeModel>("harbour.twablet", 1, 0, "QueryTypeModel");
    qmlRegisterType<qml::DescriptionFormatter>("harbour.twablet", 1, 0, "DescriptionFormatter");
    qmlRegisterType<qml::TweetFormatter>("harbour.twablet", 1, 0, "TweetFormatter");
    qmlRegisterType<qml::QuotedTweetFormatter>("harbour.twablet", 1, 0, "QuotedTweetFormatter");
    qmlRegisterType<qml::UserModel>("harbour.twablet", 1, 0, "UserModel");
    qmlRegisterType<qml::TweetQueryItem>("harbour.twablet", 1, 0, "TweetQueryItem");
    qmlRegisterType<qml::UserQueryItem>("harbour.twablet", 1, 0, "UserQueryItem");
    qmlRegisterType<qml::TweetListQueryWrapperObject>("harbour.twablet", 1, 0, "TweetListQuery");
    qmlRegisterType<qml::UserListQueryWrapperObject>("harbour.twablet", 1, 0, "UserListQuery");
    qmlRegisterType<qml::StatusUpdateQueryWrapperObject>("harbour.twablet", 1, 0, "StatusUpdateQuery");
    qmlRegisterType<qml::TweetSpecificQueryWrapperObject>("harbour.twablet", 1, 0, "TweetQuery");
    qmlRegisterType<qml::UserSpecificQueryWrapperObject>("harbour.twablet", 1, 0, "UserQuery");
    qmlRegisterSingletonType<qml::DataRepositoryObject>("harbour.twablet", 1, 0, "Repository",
                                                          [](QQmlEngine *e, QJSEngine *) -> QObject * {
        return new qml::DataRepositoryObject(e);
    });
    qmlRegisterSingletonType<Info>("harbour.twablet", 1, 0, "INFO",
                                   [](QQmlEngine *e, QJSEngine *) -> QObject * {
        return new Info(e);
    });
    qmlRegisterSingletonType<NetworkMonitor>("harbour.twablet", 1, 0, "NetworkMonitor",
                                             [](QQmlEngine *e, QJSEngine *) -> QObject * {
        return new NetworkMonitor(e);
    });

#ifndef DESKTOP
    return SailfishApp::main(argc, argv);
#else
    QGuiApplication app {argc, argv};
    QQuickView view {};
    view.setSource(QUrl(QLatin1String("qrc:/qml/harbour-twablet.qml")));
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.show();
    return app.exec();
#endif
}
Example #26
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc,argv);
    QQuickView view;
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
    view.setSource(QUrl("qrc:///LoginContainer.qml"));
    view.resize(800, 480);
    view.showFullScreen();
    return app.exec();
}
Example #27
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    qmlRegisterType<Squircle>("OpenGLUnderQML", 1, 0, "Squircle");

    QQuickView view;
    view.setSource(QUrl(QStringLiteral("qrc:///Main.qml")));
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.show();
    return app.exec();
}
Example #28
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QStringList files;
    files << "settings.ini"
          << "description-xmls/device.xml"
          << "description-xmls/configmgmt.xml"
          << "description-xmls/transport.xml"
          << "description-xmls/datamodel.xml";
    setupFiles(APP_NAME, files);

    const QString settingsPath
            = QDir::homePath() + "/." + APP_NAME + "/settings.ini";
    DeviceSettings settings(settingsPath);

    UcaStack *uca = new UcaStack(settings.getQSettings());
    IUPnPStack *uda = NULL;
#ifndef WIN32
    uda = UdaStack::getInstance();
#endif

    int result = 0;
    try{
        LightSensor model(&settings, uda, uca, &app, APP_NAME);

        if (uda != NULL) {
#ifndef WIN32
            ((UdaStack *)uda)->initialize(&model);
#endif
            uda->start();
        }

        printf("%ld\n%ld\n", (long)&uda, (long)&model);

        QQuickView view;
        QQmlContext *context = view.rootContext();
        context->setContextProperty("dimmableLightModel", &model);
        context->setContextProperty("deviceSettings", &settings);
        view.setSource(QUrl("qrc:/qml/CloudLight/CloudLightUI.qml"));
        view.setResizeMode(QQuickView::SizeRootObjectToView);
        view.show();

        result = app.exec();

    }catch(QException e){
        result = -1;//app.exec();
        app.exit();
    }
    delete uca;
    return result;
}
Example #29
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    //    If you want to use an engine, this shows how to get an UI Element!:

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

    //    QObject root = engine.rootObjects().first();
    //    QObject element = root.findChild("element");
    //    element.setProperty("color","red");


    //Creating Objects from Qml in C++ with QQuickView
    //http://stackoverflow.com/questions/14092319/create-qml-element-in-c


    QQuickView view;
    //Background
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource(QUrl("qrc:///game.qml"));

    //Spaceshuttle
    QQmlComponent component(view.engine(), QUrl("qrc:///shuttle.qml"));
    QObject *shuttle = component.create();
    //Components are only drawn if parent is somehow related to the root view
    QQmlProperty::write(shuttle, "parent", QVariant::fromValue<QObject*>(view.rootObject()));

    //some sample "Astroids" - ( wrong Image ;) )
    QVector<QObject*> astroids(0);

    for(int i = 0; i < 5; i++){
        QQmlComponent fireballComponent(view.engine(), QUrl("qrc:///fireball.qml"));
        astroids.append(fireballComponent.create());
        QQmlProperty::write(astroids[i], "parent", QVariant::fromValue<QObject*>(view.rootObject()));
        QQmlProperty::write(astroids[i], "x", i*50);
        QQmlProperty::write(astroids[i], "y", i*50);
    }

    //QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership);

    qDebug() << shuttle->property("id").toString();

    Logger logger;
    logger.setQObject(shuttle);
    QObject::connect(shuttle, SIGNAL(xChanged()), &logger, SLOT(showCoordinates()));

    view.show();

    return app.exec();
}
int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);
    QQuickView view;

    qDebug() << "Welcome to my SmartDevCon 2012 presentation!";
    QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource(QUrl("qrc:/qml/Main.qml"));
    view.showFullScreen();

    return app.exec();
}