int main(int argc, char *argv[]) { QApplication app(argc, argv); QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); #ifdef Q_OS_SYMBIAN viewer.setMainQmlFile(QLatin1String("qrc:/qml/qvapp/qv.qml")); viewer.setSource(QUrl(QLatin1String("qrc:/qml/qvapp/qv.qml"))); #else viewer.setMainQmlFile(QLatin1String("qml/qvapp/qv.qml")); #endif #ifdef Q_OS_SYMBIAN viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView); viewer.showFullScreen(); #elif defined(Q_WS_MAEMO_5) viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView); viewer.showMaximized(); #elif defined(Q_OS_ANDROID) viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView); viewer.showFullScreen(); #else Qt::WindowFlags flags = Qt::MSWindowsFixedSizeDialogHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint; viewer.setWindowFlags(flags); viewer.setResizeMode(QDeclarativeView::SizeViewToRootObject); viewer.show(); #endif return app.exec(); }
//Main Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; //system("sudo ifup wlan0"); Downloader d; d.doDownload("http://www.vesta-tab.com/jo/showId.php"); Object data; viewer.setCursor(Qt::BlankCursor); viewer.rootContext()->setContextProperty("image", &data); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); //viewer.setMainQmlFile("qrc:/main.qml"); viewer.setSource(QUrl("qrc:/qml/BBB/main.qml")); viewer.showFullScreen(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication *lApplication = createApplication(argc, argv); QmlApplicationViewer *lView = QmlApplicationViewer::create(); QVariantList lLevelList; createAllLevels(lLevelList); lView->rootContext()->setContextProperty(QLatin1String("gLevels"), lLevelList); QNetworkAccessManager lNetworkManager; LevelModel *lLevelModel = new LevelModel(lLevelList.count(), &lNetworkManager, lApplication); lView->rootContext()->setContextProperty(QLatin1String("gLevelModel"), lLevelModel); HighScoresModel *lHighScoresModel = new HighScoresModel(lApplication); lView->rootContext()->setContextProperty(QLatin1String("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->setMainQmlFile(QLatin1String("qml/Game.qml")); lView->showFullScreen(); return lApplication->exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); qmlRegisterType<Utils>("Utils", 1,0, "Utils"); QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/MyReader/main.qml")); viewer.showFullScreen(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); qmlRegisterType<ShipRotation>("SpaceDebris", 1, 0, "ShipRotation"); qmlRegisterType<SpaceAudio>("SpaceDebris", 1, 0, "SpaceAudio"); QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); viewer.setResizeMode(QmlApplicationViewer::SizeRootObjectToView); viewer.setMainQmlFile(QLatin1String("qml/spacerace/main.qml")); viewer.showFullScreen(); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); manager mn; QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); app->setStartDragDistance(20); viewer.rootContext()->setContextProperty("mn", &mn); viewer.setMainQmlFile(QLatin1String("qml/hildonComponentsTest/main.qml")); viewer.showFullScreen(); return app->exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/experimental-gestures/experimental-gestures.qml")); viewer.showFullScreen(); viewer.showExpanded(); MyQSwipeGestureRecognizer *mySwipeGesture = new MyQSwipeGestureRecognizer; QGestureRecognizer::registerRecognizer(mySwipeGesture); MyQPanGestureRecognizer *myPanGesture = new MyQPanGestureRecognizer; QGestureRecognizer::registerRecognizer(myPanGesture); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; viewer.setAttribute(Qt::WA_LockPortraitOrientation); Helper helper; viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView); viewer.rootContext()->setContextProperty("Helper", &helper); viewer.setAttribute(Qt::WA_OpaquePaintEvent); viewer.setAttribute(Qt::WA_NoSystemBackground); viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground); viewer.setSource(QUrl("qrc:/qml/main.qml")); viewer.showFullScreen(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication app(argc, argv); // register types qmlRegisterType<DatabaseManager>("tessera", 1, 0, "Database" ); qmlRegisterType<ClipboardAdapter>("tessera", 1, 0, "Clipboard" ); qmlRegisterUncreatableType<SqlQueryModel>("tessera", 1, 0, "SqlQuery", ""); // do my cool qt4 stuff #if QT_VERSION < 0x050000 QmlApplicationViewer viewer; viewer.setSource( QUrl(QLatin1String("qrc:/qml/Symbian.qml")) ); viewer.showFullScreen(); #else // Qt5 cool stuff QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:///qml/Desktop.qml"))); #endif return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); QDir dir = QDir(QDir::home()); dir.cd("Videos"); dir.setFilter(QDir::Files); QStringList entries = dir.entryList(); QDeclarativeContext *ctxt = viewer.rootContext(); ctxt->setContextProperty("filesModel", QVariant::fromValue(entries)); ctxt->setContextProperty("filesRoot", QVariant::fromValue(dir.absolutePath())); QPixmap nullCursor(16, 16); nullCursor.fill(Qt::transparent); // QApplication::setOverrideCursor(QCursor(nullCursor)); viewer.setMainQmlFile(QLatin1String("qml/nakkikioski/main.qml")); viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView); viewer.showExpanded(); viewer.showFullScreen(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { int currentExitCode = 0; QScopedPointer<QSymbianApplication> app(new QSymbianApplication(argc, argv)); // Set App Info: app->setApplicationName("Battery Status"); app->setOrganizationName("Motaz Alnuweiri"); app->setApplicationVersion(APP_Version); // QT_DEBUG or QT_NO_DEBUG // #ifdef QT_DEBUG // // Install Debug Msgs Handler: // ClearDebugFile(); // qInstallMsgHandler(DebugFileHandler); // #endif // Install EventFilter in QApplication: //app->installEventFilter(new myEventFilter); // Set App Splash Screen: QSplashScreen *splash = new QSplashScreen(QPixmap(":qml/Images/JPG/Splash_Screen.jpg"), Qt::WindowStaysOnTopHint); splash->show(); // Check System Language & Load App Translator: QString systemLang = QLocale::system().name(); QTranslator appTranslator; systemLang.truncate(2); //truncate(2) to ignore the country code if (QFile::exists("Languages/batterystatus_" + systemLang + ".qm")) { appTranslator.load("batterystatus_" + systemLang, "Languages"); } else { appTranslator.load("batterystatus_en", "Languages"); } // Install QTranslator to QApplication: app->installTranslator(&appTranslator); // Hide The App If Deactive: if (!app->foreground()) QSymbianHelper::hideInBackground(); // Register QSettings: QAppSettings appSettings; // Register QmlApplicationViewer: QmlApplicationViewer *viewer = new QmlApplicationViewer(); //viewer.setResizeMode(QmlApplicationViewer::SizeRootObjectToView); //viewer.setAutoFillBackground(false); //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); // Register App HSWidget: QBatteryHSWidget *batteryHSWidget = new QBatteryHSWidget(); batteryHSWidget->setBackgroundOpacity(appSettings.getWidgetOpacity()); // Register QDeviceName: QDeviceName deviceName; // Register Class to QML: qmlRegisterType<QPSMode>("PSMode", 1, 0, "PSMode"); qmlRegisterType<QGlobalNote>("GlobalNote", 1, 0, "GlobalNote"); qmlRegisterType<QCBatteryInfo>("CBatteryInfo", 1, 0, "CBatteryInfo"); qmlRegisterType<CommonType>("CommonType", 1, 0, "CommonType"); // Set Propertys to QML: viewer->rootContext()->setContextProperty("APPName", QObject::tr("Battery Status")); viewer->rootContext()->setContextProperty("APPVersion", app->applicationVersion()); viewer->rootContext()->setContextProperty("AppPath", app->applicationDirPath()); viewer->rootContext()->setContextProperty("SymbianHelper", new QSymbianHelper); viewer->rootContext()->setContextProperty("AppSettings", &appSettings); viewer->rootContext()->setContextProperty("HSWidget", batteryHSWidget); viewer->rootContext()->setContextProperty("DeviceName", &deviceName); viewer->rootContext()->setContextProperty("QApp", app->instance()); viewer->setSource(QUrl(QLatin1String("qrc:qml/main.qml"))); //viewer.setSource(QUrl::fromLocalFile("qrc:qml/main.qml")); // Lock screen orientation in portrait only //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); //viewer.setGeometry(app->desktop()->screenGeometry()); viewer->showFullScreen(); // Stop Splash Screen & Delete It: splash->finish(viewer); splash->deleteLater(); //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // Enter App Event Loop: currentExitCode = app->exec(); // Cleun Pointers: delete viewer; delete batteryHSWidget; // Check If App Is Restarting: if(app->isRestarting()) { // Workround for my app to restart it self QProcess::startDetached(qApp->applicationFilePath()); } return currentExitCode; }
int main(int argc, char *argv[]) { QApplication app(argc, argv); bool use_qml; #ifdef USE_QML use_qml = true; #else use_qml = false; #endif QStringList options = app.arguments(); if (options.contains("--use-qml")) use_qml = true; if (options.contains("--dont-use-qml")) use_qml = false; if (use_qml) { qRegisterMetaType<DNSSECTest>("DNSSECTest"); qmlRegisterType<DNSSECTest, 1>("DNSSECTools", 1, 0, "DNSSECTest"); qmlRegisterType<TestManager, 1>("DNSSECTools", 1, 0, "TestManager"); QmlApplicationViewer viewer; QDeclarativeContext *context; viewer.addImportPath(":/qml"); viewer.setWindowIcon(QIcon(":/images/dnssec-check-64x64.png")); viewer.setWindowTitle("DNSSEC-Check"); TestManager manager; context = viewer.rootContext(); context->setContextProperty("testManager", &manager); #ifdef IS_MEEGO viewer.setSource(QUrl("qrc:/qml/MeegoDnssecCheck.qml")); #else viewer.setSource(QUrl("qrc:/qml/DnssecCheck.qml")); #endif viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); #ifdef IS_MEEGO viewer.showFullScreen(); #else viewer.show(); #endif return app.exec(); } else { // don't use QML MainWindow mainWindow; mainWindow.setOrientation(MainWindow::Auto); #ifdef Q_OS_SYMBIAN mainWindow.showFullScreen(); #elif defined(Q_WS_MAEMO_5) mainWindow.showMaximized(); #else mainWindow.show(); #endif return app.exec(); } }
int main(int argc, char *argv[]) { #ifdef USE_OPENGL_GRAPHICS_SYSTEM QApplication::setGraphicsSystem("opengl"); #endif QApplication app(argc, argv); #ifdef PERFORMANCEMONITOR_SUPPORT PerformanceMonitor::qmlRegisterTypes(); #endif QUrl fileName; qreal volume = 0.5; QStringList args = app.arguments(); #ifdef PERFORMANCEMONITOR_SUPPORT PerformanceMonitor::State performanceMonitorState; #endif for (int i=1; i<args.count(); ++i) { const QString &arg = args.at(i); if (arg.startsWith('-')) { if ("-volume" == arg) { if (i+1 < args.count()) volume = 0.01 * args.at(++i).toInt(); else qtTrace() << "Option \"-volume\" takes a value"; } #ifdef PERFORMANCEMONITOR_SUPPORT else if (PerformanceMonitor::parseArgument(arg, performanceMonitorState)) { // Do nothing } #endif else { qtTrace() << "Option" << arg << "ignored"; } } else { if (fileName.isEmpty()) fileName = QUrl::fromLocalFile(arg); else qtTrace() << "Argument" << arg << "ignored"; } } QmlApplicationViewer viewer; #ifndef USE_OPENGL_GRAPHICS_SYSTEM QGLFormat format = QGLFormat::defaultFormat(); format.setSampleBuffers(false); format.setSwapInterval(1); QGLWidget* glWidget = new QGLWidget(format); glWidget->setAutoFillBackground(false); viewer.setViewport(glWidget); #endif viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/qmlvideofx/") + MainQmlFile); viewer.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); QGraphicsObject *rootObject = viewer.rootObject(); rootObject->setProperty("fileName", fileName); viewer.rootObject()->setProperty("volume", volume); #ifdef PERFORMANCEMONITOR_SUPPORT if (performanceMonitorState.valid) { rootObject->setProperty("perfMonitorsLogging", performanceMonitorState.logging); rootObject->setProperty("perfMonitorsVisible", performanceMonitorState.visible); } PaintEventMonitor paintEventMonitor; paintEventMonitor.setTarget(viewer.viewport()); QObject::connect(&paintEventMonitor, SIGNAL(targetPainted()), rootObject, SLOT(qmlFramePainted())); #endif FileReader fileReader; viewer.rootContext()->setContextProperty("fileReader", &fileReader); QString imagePath = "../../images"; const QString picturesLocation = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation); if (!picturesLocation.isEmpty()) imagePath = picturesLocation; viewer.rootContext()->setContextProperty("imagePath", imagePath); QString videoPath; const QString moviesLocation = QDesktopServices::storageLocation(QDesktopServices::MoviesLocation); if (!moviesLocation.isEmpty()) videoPath = moviesLocation; viewer.rootContext()->setContextProperty("videoPath", videoPath); #ifdef SMALL_SCREEN_PHYSICAL viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); viewer.showFullScreen(); #else viewer.showExpanded(); #endif // Delay invocation of init until the event loop has started, to work around // a GL context issue on Harmattan: without this, we get the following error // when the first ShaderEffectItem is created: // "QGLShaderProgram::addShader: Program and shader are not associated with same context" QMetaObject::invokeMethod(viewer.rootObject(), "init", Qt::QueuedConnection); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication *app = createApplication(argc, argv); QmlApplicationViewer viewer; #if defined(Q_OS_MAEMO) QPixmap pixmap("/opt/nelisquare/qml/pics/splash-turned.png"); QSplashScreen splash(pixmap); EventDisabler eventDisabler; splash.installEventFilter(&eventDisabler); splash.showFullScreen(); #endif #if defined(Q_OS_MAEMO) viewer.addImportPath(QString("/opt/qtm12/imports")); viewer.engine()->addImportPath(QString("/opt/qtm12/imports")); viewer.engine()->addPluginPath(QString("/opt/qtm12/plugins")); #endif QCoreApplication::addLibraryPath(QString("/opt/nelisquare/plugins")); viewer.setAttribute(Qt::WA_OpaquePaintEvent); viewer.setAttribute(Qt::WA_NoSystemBackground); viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground); WindowHelper *windowHelper = new WindowHelper(&viewer); PictureHelper *pictureHelper = new PictureHelper(); Cache *cache = new Cache(); viewer.rootContext()->setContextProperty("windowHelper", windowHelper); viewer.rootContext()->setContextProperty("pictureHelper", pictureHelper); viewer.rootContext()->setContextProperty("cache", cache); Molome *molome = new Molome(); viewer.rootContext()->setContextProperty("molome", molome); #if defined(Q_OS_HARMATTAN) || defined(Q_WS_SIMULATOR) || defined(Q_OS_MAEMO) PlatformUtils platformUtils(app,cache); viewer.rootContext()->setContextProperty("platformUtils", &platformUtils); #endif #if defined(Q_OS_MAEMO) viewer.installEventFilter(windowHelper); #elif defined(Q_OS_HARMATTAN) viewer.installEventFilter(new EventFilter); #endif viewer.setMainQmlFile(QLatin1String("qml/main.qml")); QObject *rootObject = qobject_cast<QObject*>(viewer.rootObject()); #if defined(Q_OS_HARMATTAN) || defined(Q_OS_MAEMO) new NelisquareDbus(app, &viewer); #endif #if defined(Q_OS_MAEMO) viewer.showFullScreen(); #elif defined(Q_OS_HARMATTAN) rootObject->connect(molome,SIGNAL(infoUpdated(QVariant,QVariant)),SLOT(onMolomeInfoUpdate(QVariant,QVariant))); rootObject->connect(molome,SIGNAL(photoRecieved(QVariant,QVariant)),SLOT(onMolomePhoto(QVariant,QVariant))); viewer.showExpanded(); molome->updateinfo(); #else viewer.showExpanded(); #endif rootObject->connect(pictureHelper,SIGNAL(pictureUploaded(QVariant, QVariant)),SLOT(onPictureUploaded(QVariant, QVariant))); #if defined(Q_OS_MAEMO) splash.finish(&viewer); #endif return app->exec(); }