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(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QQuickView viewer; PackageManager *pm = new PackageManager(&viewer); QDeclarativeContext *context = viewer.rootContext(); context->setContextProperty("initialstate", "mainview"); context->setContextProperty("mainWindow", &viewer); viewer.engine()->addImageProvider(QLatin1String("icons"), new IconProvider); viewer.engine()->addImportPath("/usr/lib/qt5/imports"); qmlRegisterType<Package>("Package", 1,0, "Package"); qmlRegisterType<PackageGroup>("Package", 1,0, "PackageGroup"); qmlRegisterType<PackageMarkings>("Package", 1, 0, "PackageMarkings"); qmlRegisterType<Repository>("Repository", 1,0, "Repository"); viewer.setMainQmlFile(QLatin1String("qml/package-manager/main.qml")); viewer.setOrientation(QQuickView::ScreenOrientationAuto); viewer.showExpanded(); return app.exec(); }
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(); }
//===================================================================================================================== 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(); }
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(); }
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(); }
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(); }
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();\ }
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(); }
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) { // Initialize the Qt Application QGuiApplication app(argc, argv); // Register the HullRenderer QML Type qmlRegisterType<HullRenderer>("com.nearce.HullRenderer", 1, 0, "HullRenderer"); // Establish the Qt Quick View QQuickView view; // Create the algorithm objecsts GrahamScan grahamScan; JarvisMarch jarvisMarch; // Create the input genration objects RandomPointInput randomPointInput(50, 1000); CircularPointInput circularPointInput(50, 1000); // Establish list of avalible alogrithms & inputs for the Hull Solver QMap<QString, HullAlgorithm*> algorithms({ {grahamScan.name(), &grahamScan}, {jarvisMarch.name(), &jarvisMarch} }); QMap<QString, DataInput*> inputs({ {randomPointInput.name(), &randomPointInput}, {circularPointInput.name(), &circularPointInput} }); HullSolver solver(algorithms, inputs); // Inject some C++ objects into the QML document structure view.engine()->rootContext()->setContextProperty("random_input", &randomPointInput); view.engine()->rootContext()->setContextProperty("circular_input", &circularPointInput); view.engine()->rootContext()->setContextProperty("hull_solver", &solver); // Establish a dynamicly resizing content resize policy & display the QML window view.setResizeMode(QQuickView::SizeRootObjectToView); view.setSource(QUrl("qrc:///resources/main.qml")); view.showMaximized(); // Create a signal slot connection between the HullRenderer QML object // and the hull solver in C++ for convience HullRenderer* renderer = view.rootObject()->findChild<HullRenderer*>("renderer"); QObject::connect(&solver, SIGNAL(solutionFound(const HullTimeline&)), renderer, SLOT(setTimeline(const HullTimeline&))); 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(); }
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(); }
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[]) { // 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(); }
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(); }
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(); }
//![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(); } }
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(); } }
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(); }
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(); }
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(); }
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(); }
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(); }
void HtmlEditor::on_actionTextShadow_triggered() { QQuickView* view = new QQuickView(QUrl::fromLocalFile(qmlFilePath("text_shadow.qml"))); view->setTitle(tr("Text Shadow")); view->setColor(palette().window().color()); connect(view->rootObject(), SIGNAL(accepted(QString)), SLOT(formatTextShadow(QString))); connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); view->show(); }
int main(int argc, char* argv[]) { QGuiApplication app(argc,argv); QQuickView view; GameData *game = new GameData(); view.engine()->rootContext()->setContextObject(game); view.engine()->rootContext()->setContextProperty("gameData", game); view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); view.setSource(QUrl::fromLocalFile(QString("rsc/main.qml"))); if (QGuiApplication::platformName() == QLatin1String("qnx") || QGuiApplication::platformName() == QLatin1String("eglfs")) { view.setResizeMode(QQuickView::SizeRootObjectToView); view.showFullScreen(); } else { view.show(); } return app.exec(); }
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(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQuickView viewer; viewer.engine()->addImportPath(QStringLiteral("qrc:/qml")); viewer.setSource(QUrl(QStringLiteral("qrc:/qml/qml/plugins.qml"))); viewer.show(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); // QQmlApplicationEngine engine; qmlRegisterType<FrameFilter>("qmlvideofilter", 1, 0, "FrameFilter" ); qmlRegisterType<AnalyzeResult>("qmlvideofilter", 1, 0, "AnalyzeResult"); qmlRegisterType<BCVEncoder>("qmlbcvencoder", 1, 0, "BCVEncoder"); qmlRegisterType<BCVDecoder>("qmlbcvdecoder", 1, 0, "BCVDecoder"); ImageProvider* ImgProvider = new ImageProvider(); QQuickView view; view.setSource(QUrl("qrc:/main.qml")); view.engine()->addImageProvider( QLatin1String("provider"), ImgProvider ); view.engine()->rootContext()->setContextProperty("ProviderImg", ImgProvider ); 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(); }