Пример #1
0
/*------------------------------------------------------------------------------
|    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();
}
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();
}
Пример #3
0
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();
}
Пример #4
0
int main(int argc, char *argv[]) {
    QGuiApplication* app = SailfishApp::application(argc, argv);
    QQuickView* view = SailfishApp::createView();

    Configurator config;
    config.load();

    //qmlRegisterType<Request>("Sailbook.Request", 1, 0, "Request");
    qmlRegisterUncreatableType<Request>("App.Sailbook", 1, 0, "Request", QStringLiteral("Error"));
    //qmlRegisterInterface<SessionManager>("SessionManager");

    SessionManager session(QStringLiteral(APPID), config.getValue(QStringLiteral("token")).toString());
    session.setExtendedPermission(SessionManager::ExtendedPermissions(
        SessionManager::Email |
        SessionManager::ManageNotifications |
        SessionManager::ManagePages |
        SessionManager::PublishActions |
        SessionManager::ReadFriendList |
        SessionManager::ReadInsights |
        SessionManager::ReadMailbox |
        SessionManager::ReadPageMailboxes |
        SessionManager::ReadStream |
        SessionManager::RsvpEvent
    ));

    session.setUserDataPermission(SessionManager::UserDataPermissions(
        SessionManager::UserAboutMe |
        SessionManager::UserActionsBooks |
        SessionManager::UserActionsMusic |
        SessionManager::UserActionsNews |
        SessionManager::UserActionsVideo |
        SessionManager::UserActivities |
        SessionManager::UserBirthday |
        SessionManager::UserEducationHistory |
        SessionManager::UserEvents |
        SessionManager::UserFriends |
        SessionManager::UserGamesActivity |
        SessionManager::UserGroups |
        SessionManager::UserHometown |
        SessionManager::UserInterests |
        SessionManager::UserLikes |
        SessionManager::UserLocation |
        SessionManager::UserPhotos |
        SessionManager::UserRelationshipDetails |
        SessionManager::UserRelationships |
        SessionManager::UserReligionPolitics |
        SessionManager::UserStatus |
        SessionManager::UserTaggedPlaces |
        SessionManager::UserVideos |
        SessionManager::UserWebsite |
        SessionManager::UserWorkHistory
    ));

    view->rootContext()->setContextProperty("SessionManager", &session);
    view->rootContext()->setContextProperty("Configurator", &config);
    view->setSource(SailfishApp::pathTo("qml/sailbook.qml"));
    view->show();

    return app->exec();
}
Пример #5
0
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).

    qRegisterMetaType<QList<FileInfoEntry*> >();

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

    // Add image providers and C++ classes
    view->engine()->addImageProvider(QLatin1String("thumbnail"), new ThumbnailProvider);

    FileEngine fileEngine;
    view->engine()->rootContext()->setContextProperty("engine", &fileEngine);
    view->engine()->rootContext()->setContextProperty("fileList", fileEngine.fileList);
    view->engine()->rootContext()->setContextProperty("fileInfo", fileEngine.fileInfo);
    view->engine()->rootContext()->setContextProperty("fileProcess", fileEngine.fileProcess);
    view->engine()->rootContext()->setContextProperty("clipboard", fileEngine.clipboard);
    view->engine()->rootContext()->setContextProperty("settings", fileEngine.settings);
    view->engine()->rootContext()->setContextProperty("coverModel", fileEngine.coverModel);

    // Show the application
    view->setSource(SailfishApp::pathTo("qml/Filetug.qml"));
    view->show();

    return app->exec();
}
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();
}
Пример #7
0
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).

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

    QTranslator translator;
    translator.load(QLocale::system(), "ownNotes", "_", SailfishApp::pathTo("i18n").toLocalFile(), ".qm");
    app->installTranslator(&translator);
    QPython::registerQML();
    qmlRegisterType<DocumentHandler>("net.khertan.documenthandler", 1, 0, "DocumentHandler");
    QQuickView *view = SailfishApp::createView();
    view->setSource(SailfishApp::pathTo("qml/ownNotes.qml"));
    view->engine()->rootContext()->setContextProperty("VERSION", VERSION);
    view->show();

    return app->exec();
}
Пример #8
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();
}
Пример #9
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();
            }
        }
Пример #10
0
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);
   }
Пример #11
0
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();
}
Пример #12
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();
}
Пример #13
0
void tst_qquickpointdirection::test_basic()
{
    QQuickView* view = createView(testFileUrl("basic.qml"), 600);
    QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
    ensureAnimTime(600, system->m_animation);

    QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
    for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) {
        if (d->t == -1)
            continue; //Particle data unused

        QCOMPARE(d->x, 0.f);
        QCOMPARE(d->y, 0.f);
        QCOMPARE(d->vx, 100.f);
        QCOMPARE(d->vy, 100.f);
        QVERIFY(d->ax >= 0.f);
        QVERIFY(d->ax <= 200.f);
        QVERIFY(d->ay >= 0.f);
        QVERIFY(d->ay <= 200.f);
        QCOMPARE(d->lifeSpan, 0.5f);
        QCOMPARE(d->size, 32.f);
        QCOMPARE(d->endSize, 32.f);
        QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
    }
    delete view;
}
Пример #14
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();
            }
        }
Пример #15
0
bool MascaraInterfaceV1::eventFilter(QObject *obj, QEvent *e)
{
    bool ret = QObject::eventFilter(obj, e);
    if (ret)
        return ret;

    if (e->type() == QEvent::Close) {
        QQuickView *view = qobject_cast<QQuickView *>(obj);
        if (!view) {
            qWarning() << "No view!";
            return ret;
        }

        int dialogId = view->property("MascaraWindowId").toInt();
        QHash<int, QQuickView *>::iterator it = m_windows.find(dialogId);
        if (it == m_windows.end()) {
            qWarning() << "Destroyed an unknown dialog " << dialogId;
            return ret;
        }

        m_windows.erase(it);
        qDebug() << "Deleting " << view;
        view->deleteLater();

        if (m_windows.count() == 0) {
            m_closeTimer.start();
            qDebug() << "Starting close timer";
        }
    }

    return ret;
}
Пример #16
0
void tst_qquickcustomaffector::test_move()
{
    QQuickView* view = createView(testFileUrl("move.qml"), 600);
    QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
    ensureAnimTime(600, system->m_animation);

    QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
    for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) {
        if (d->t == -1)
            continue; //Particle data unused
        if (!d->stillAlive(system))
            continue; //parameters no longer get set once you die

        QVERIFY2(myFuzzyCompare(d->curX(system), 50.0), QByteArray::number(d->curX(system)));
        QVERIFY2(myFuzzyCompare(d->curY(system), 50.0), QByteArray::number(d->curY(system)));
        QVERIFY2(myFuzzyCompare(d->curVX(system), 50.0), QByteArray::number(d->curVX(system)));
        QVERIFY2(myFuzzyCompare(d->curVY(system), 50.0), QByteArray::number(d->curVY(system)));
        QVERIFY2(myFuzzyCompare(d->curAX(), 50.0), QByteArray::number(d->curAX()));
        QVERIFY2(myFuzzyCompare(d->curAY(), 50.0), QByteArray::number(d->curAY()));
        QCOMPARE(d->lifeSpan, 0.5f);
        QCOMPARE(d->size, 32.f);
        QCOMPARE(d->endSize, 32.f);
        QVERIFY2(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)),
                 QString::fromLatin1("%1 <= %2 / 1000").arg(d->t).arg(system->timeInt).toUtf8());
    }
    delete view;
}
Пример #17
0
void tst_qquickcustomaffector::test_basic()
{
    QQuickView* view = createView(testFileUrl("basic.qml"), 600);
    QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
    ensureAnimTime(600, system->m_animation);

    QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
    for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) {
        if (d->t == -1)
            continue; //Particle data unused
        //in CI the whole simulation often happens at once, so dead particles end up missing out
        if (!d->stillAlive(system))
            continue; //parameters no longer get set once you die

        QCOMPARE(d->x, 100.f);
        QCOMPARE(d->y, 100.f);
        QCOMPARE(d->vx, 100.f);
        QCOMPARE(d->vy, 100.f);
        QCOMPARE(d->ax, 100.f);
        QCOMPARE(d->ay, 100.f);
        QCOMPARE(d->lifeSpan, 0.5f);
        QCOMPARE(d->size, 100.f);
        QCOMPARE(d->endSize, 100.f);
        QCOMPARE(d->autoRotate, 1.f);
        QCOMPARE(d->color.r, (uchar)0);
        QCOMPARE(d->color.g, (uchar)255);
        QCOMPARE(d->color.b, (uchar)0);
        QCOMPARE(d->color.a, (uchar)0);
        QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
    }
    delete view;
}
Пример #18
0
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();
}
Пример #19
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();
            }
        }
Пример #20
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();\
}
Пример #21
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();

}
Пример #22
0
QQuickView *QQuickViewTestUtil::createView()
{
    QQuickView *window = new QQuickView(0);
    const QSize size(240, 320);
    window->resize(size);
    QQuickViewTestUtil::centerOnScreen(window, size);
    return window;
}
Пример #23
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    QQuickView view;
    view.setSource(QUrl("qrc:/qrc_example.qml"));
    view.show();
    return app.exec();
}
Пример #24
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();
}
Пример #25
0
void tst_QQuickAccessible::hitTest()
{
    QQuickView *window = new QQuickView;
    window->setSource(testFileUrl("hittest.qml"));
    window->show();

    QAccessibleInterface *windowIface = QAccessible::queryAccessibleInterface(window);
    QVERIFY(windowIface);
    QAccessibleInterface *rootItem = windowIface->child(0);
    QRect rootRect = rootItem->rect();

    // check the root item from app
    QAccessibleInterface *appIface = QAccessible::queryAccessibleInterface(qApp);
    QVERIFY(appIface);
    QAccessibleInterface *itemHit = appIface->childAt(rootRect.x() + 200, rootRect.y() + 50);
    QVERIFY(itemHit);
    QCOMPARE(itemHit->rect(), rootRect);

    QAccessibleInterface *rootItemIface;
    for (int c = 0; c < rootItem->childCount(); ++c) {
        QAccessibleInterface *iface = rootItem->child(c);
        QString name = iface->text(QAccessible::Name);
        if (name == QLatin1String("rect1")) {
            // hit rect1
            QAccessibleInterface *rect1 = iface;
            QRect rect1Rect = rect1->rect();
            QAccessibleInterface *rootItemIface = rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10);
            QVERIFY(rootItemIface);
            QCOMPARE(rect1Rect, rootItemIface->rect());
            QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect1"));

            // should also work from top level (app)
            QAccessibleInterface *app(QAccessible::queryAccessibleInterface(qApp));
            QAccessibleInterface *itemHit2(topLevelChildAt(app, rect1Rect.x() + 10, rect1Rect.y() + 10));
            QVERIFY(itemHit2);
            QCOMPARE(itemHit2->rect(), rect1Rect);
            QCOMPARE(itemHit2->text(QAccessible::Name), QLatin1String("rect1"));
        } else if (name == QLatin1String("rect2")) {
            QAccessibleInterface *rect2 = iface;
            // FIXME: This is seems broken on OS X
            // QCOMPARE(rect2->rect().translated(rootItem->rect().x(), rootItem->rect().y()), QRect(0, 50, 100, 100));
            QAccessibleInterface *rect20 = rect2->child(0);
            QVERIFY(rect20);
            QCOMPARE(rect20->text(QAccessible::Name), QLatin1String("rect20"));
            QPoint p = rect20->rect().bottomRight() + QPoint(20, 20);
            QAccessibleInterface *rect201 = rect20->childAt(p.x(), p.y());
            QVERIFY(rect201);
            QCOMPARE(rect201->text(QAccessible::Name), QLatin1String("rect201"));
            rootItemIface = topLevelChildAt(windowIface, p.x(), p.y());
            QVERIFY(rootItemIface);
            QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect201"));

        }
    }

    delete window;
    QTestAccessibility::clearEvents();
}
Пример #26
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
}
Пример #27
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();
}
Пример #28
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();
}
Пример #29
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QQuickView viewer;
    viewer.setSource(QUrl::fromLocalFile("qml/main.qml"));
    viewer.show();

    return app.exec();
}
Пример #30
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QQuickView view;
    view.setSource(QUrl(QStringLiteral("qrc:/qml/qmlwebsocketclient/main.qml")));
    view.show();

    return app.exec();
}