Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication app(argc, argv); InitProduct(argc, argv); app.setWindowIcon(QIcon("logo.ico")); QDesktopWidget* desktopWidget = QApplication::desktop(); //获取可用桌面大小 QRect deskRect =desktopWidget->availableGeometry(); //获取设备屏幕大小 //QRect screenRect =desktopWidget->screenGeometry(); DataFilter dataFilter; QDeclarativeView viewer; viewer.setWindowFlags(Qt::FramelessWindowHint); QDeclarativeEngine *engine=viewer.engine(); QDeclarativeContext *context=engine->rootContext(); context->setContextProperty("dataFilter", &dataFilter); context->setContextProperty("app", &app); context->setContextProperty("main_window", &viewer); context->setContextProperty("windowTitle", WindowTitle); context->setContextProperty("SMF_Product", SMF_Product); context->setContextProperty("WIDTH", deskRect.width()); context->setContextProperty("HEIGHT", deskRect.height()); viewer.setSource(QUrl("qml/LotNo/main.qml")); viewer.show(); return app.exec(); }
int main(int argc, char **argv) { QApplication app(argc, argv); QUrl proxyUrl(qgetenv("http_proxy")); if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) { int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080; QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort); QNetworkProxy::setApplicationProxy(proxy); } else { QNetworkProxyQuery query(QUrl(QLatin1String("http://www.flickr.com"))); QNetworkProxy proxy = QNetworkProxyFactory::systemProxyForQuery(query).value(0); if (proxy.type() != QNetworkProxy::NoProxy) QNetworkProxy::setApplicationProxy(proxy); } QDeclarativeView view; view.setSource(QUrl("qrc:/qml/flickr.qml")); #if defined(FLICKR_FULLSCREEN) view.window()->showFullScreen(); #else view.window()->show(); #endif QObject::connect(view.engine(), SIGNAL(quit()), &view, SLOT(close())); return app.exec(); }
int main(int argc, char* argv[]) { QApplication app(argc, argv); QWidget wi(0); PDPI = wi.logicalDpiX(); // physical resolution DPI = PDPI; // logical drawing resolution DPMM = DPI / INCH; // dots/mm runtime = new Runtime; MScore::init(); seq = new Seq; if (!seq->init()) { printf("cannot initialize sequencer\n"); exit(-1); } qmlRegisterType<ScoreView>("MuseScore", 1, 0, "ScoreView"); QDeclarativeView view; view.setResizeMode(QDeclarativeView::SizeRootObjectToView); QDeclarativeContext* ctxt = view.rootContext(); ctxt->setContextProperty(QLatin1String("runtime"), runtime); // registering only for exposing the Runtime::Orientation enum qmlRegisterUncreatableType<Runtime>("Qt", 4, 7, "Orientation", QString()); qmlRegisterUncreatableType<Runtime>("QtQuick", 1, 0, "Orientation", QString()); view.setSource(QUrl("qrc:/mplayer.qml")); view.show(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QDeclarativeEngine engine; QDeclarativeComponent component(&engine, QUrl("qrc:/invoke.qml")); QObject *object = component.create(); QVariant returnedValue; QVariant msg = "Hello from C++"; QMetaObject::invokeMethod(object, "myQmlFunction", Q_RETURN_ARG(QVariant, returnedValue), Q_ARG(QVariant, msg)); qDebug() << "QML function returned:" << returnedValue.toString(); delete object; QDeclarativeView view; MyClass myClass; view.rootContext()->setContextProperty("myObject", &myClass); view.setSource(QUrl("qrc:/invoke.qml")); view.show(); return a.exec(); }
int main(int argc, char *argv[]) { int count; count = PSMoveQt::count(); if (count < 2) { std::cout << "Please connect at least 2 controllers." << std::endl; } else { std::cout << "Controllers connected: " << count << std::endl; } QApplication app(argc, argv); // Register the "PSMove" object for usage in QML PSMoveQt::registerQML(); QDeclarativeView view; view.setWindowTitle("PS Move API - Qt Declarative Example (Multiple Controllers)"); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); view.setSource(QUrl("qrc:/multiple.qml")); view.show(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QGraphicsScene scene; QGraphicsView view(&scene); // Add a Widget WidgetLoader *loader = new WidgetLoader; scene.addWidget(loader); //Add a second one and move to right side AnalogClock *clock = new AnalogClock; clock->move(QPoint(300,0)); scene.addWidget(clock); //Finally the sampleWidget SampleWidget *widget = new SampleWidget; widget->move(0,300); scene.addWidget(widget); //Place a qml Widget QDeclarativeView *qmlView = new QDeclarativeView; qmlView->setSource(QUrl::fromLocalFile("qml/QMLBusTimetable.qml")); scene.addWidget(qmlView); qmlView->move(300,300); view.showMaximized(); //Fullscreen: // view.showFullScreen(); return a.exec(); }
int main(int argc, char **argv) { QApplication a(argc, argv); QDeclarativeView v; v.setAttribute(Qt::WA_OpaquePaintEvent); v.setAttribute(Qt::WA_NoSystemBackground); v.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); v.viewport()->setAttribute(Qt::WA_NoSystemBackground); QDeclarativeContext *c = v.rootContext(); c->setContextProperty("fileBrowserUtils", new Utils); if (QFile::exists("main.qml")) v.setSource(QUrl::fromLocalFile("main.qml")); else v.setSource(QUrl("qrc:/qml/main.qml")); if (QCoreApplication::arguments().contains("-fullscreen")) { qDebug() << Q_FUNC_INFO << "Starting in fullscreen mode"; v.showFullScreen(); } else { qDebug() << Q_FUNC_INFO << "Starting in windowed mode"; v.show(); } return a.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QDeclarativeView view; QDeclarativeContext *context = view.rootContext(); context->setContextProperty("backgroundColor", QColor(Qt::yellow)); KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(view.engine()); kdeclarative.initialize(); //binds things like kconfig and icons kdeclarative.setupBindings(); //If all gone well, the QScriptEngine has been extracted QScriptEngine *scriptEngine = kdeclarative.scriptEngine(); Q_ASSERT(scriptEngine); //Bind a test QObject in the "QtScript way" QScriptValue global = scriptEngine->globalObject(); TestObject *testObject = new TestObject(); QScriptValue testValue = scriptEngine->newQObject(testObject); testValue.setScope(global); global.setProperty("testObject", testValue); view.setSource(QUrl::fromLocalFile("test.qml")); view.show(); return app.exec(); }
int main(int argc, char *argv[]) { Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("applications.AuthenticationApplication")); PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties")); WatchdogThread watchdogThread(iviLink::SystemController::AUTHENTICATION_APP); watchdogThread.start(); LOG4CPLUS_INFO(logger, "Authentication main()"); QApplication app(argc, argv); app.setApplicationName("AuthenticationApplication"); app.setQuitOnLastWindowClosed(true); QDeclarativeView viewer; QMLAuthenticationDialog * dialog = new QMLAuthenticationDialog; viewer.rootContext()->setContextProperty("QMLAuthenticationDialog", dialog); viewer.setSource(QUrl::fromLocalFile("qml/AuthenticationApplication/authentication.qml")); viewer.setAttribute(Qt::WA_TranslucentBackground); viewer.setAttribute(Qt::WA_NoSystemBackground); viewer.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); viewer.setStyleSheet("background:transparent;"); // show the application viewer.move(QApplication::desktop()->screen()->rect().center() - viewer.rect().center() ); viewer.show(); dialog->init(); LOG4CPLUS_TRACE(Logger::getInstance(LOG4CPLUS_TEXT("profiler.ComponentIsStarted")), "AuthenticationApplication"); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); ChronoList chronos; PilotList pilots; TrackList tracks; pilots.loadFromXml(); tracks.loadFromXml(); qmlRegisterType<Chrono>("libchrono", 1, 0, "Chrono"); qmlRegisterType<ChronoList>("libchrono", 1, 0, "ChronoList"); qmlRegisterType<Pilot>("libchrono", 1, 0, "Pilot"); qmlRegisterType<PilotList>("libchrono", 1, 0, "PilotList"); qmlRegisterType<Track>("libchrono", 1, 0, "Track"); qmlRegisterType<TrackList>("libchrono", 1, 0, "TrackList"); QDeclarativeView engine; engine.rootContext()->setContextProperty("chronos", &chronos); engine.rootContext()->setContextProperty("pilots", &pilots); engine.rootContext()->setContextProperty("tracks", &tracks); engine.setSource(QUrl("/usr/share/autodash/chrono.qml")); engine.show(); return app.exec(); }
int main(int argc, char* argv[]) { QApplication app(argc, argv); QDeclarativeView view; view.setSource(QUrl(QCoreApplication::arguments().at(1))); view.show(); return app.exec(); }
//![0] int main(int argc, char *argv[]) { QApplication app(argc, argv); QDeclarativeView view; view.setSource(QUrl("qrc:/main.qml")); view.show(); return app.exec(); }
int main(int argc, char **argv) { QApplication app(argc, argv); qmlRegisterType<LayoutDirectionSetter>("LayoutDirectionSetter", 1, 0, "LayoutDirectionSetter"); QDeclarativeView view; view.setSource(QUrl("qrc:/main.qml")); view.show(); return app.exec(); }
int main(int argc, char *argv[]) { #if defined(LUGDULOV_MEEGO) QCoreApplication::setOrganizationName("net.iksaif.lugdulov"); #else QCoreApplication::setOrganizationName("Lugdulov"); #endif QCoreApplication::setApplicationName("Lugdulov"); QCoreApplication::setApplicationVersion(LUGDULOV_VERSION); #ifdef HAVE_MEEGOTOUCH QApplication *app = MDeclarativeCache::qApplication(argc, argv); #else QApplication application(argc, argv); QApplication *app = &application; #endif init_translations(); init_libraries(); Settings *settings = Settings::settings(); PluginsModel *plugins = PluginsModel(); qmlRegisterUncreatableType<Settings>("net.iksaif.lugdulov", 1, 0, "Settings"); qmlRegisterUncreatableType<PluginsModel>("net.iksaif.lugdulov", 1, 0, "PluginsModel", "This object is created in the model."); qmlRegisterUncreatableType<StationsModel>("net.iksaif.lugdulov", 1, 0, "StationsModel", "This object is created in the model."); qmlRegisterUncreatableType<StationsSortFilterProxyModel>("net.iksaif.lugdulov", 1, 0, "StationsSortFilterModel", "This object is created in the model."); #ifdef HAVE_MEEGOTOUCH QDeclarativeView *view = MDeclarativeCache::qDeclarativeView(); #else QDeclarativeView *view = new QDeclarativeView(); #endif QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit())); view->rootContext()->setContextProperty("plugins", plugins); view->rootContext()->setContextProperty("settings", settings); #ifdef LUGDULOV_PLATFORM_HARMATTAN view->setSource(QUrl("qrc:/qml/harmattan/main.qml")); view->showFullScreen(); #elif defined(Q_OS_SYMBIAN) view->setSource(QUrl("qrc:/qml/symbian/main.qml")); view->showFullScreen(); #else view->setSource(QUrl("qrc:/qml/generic/main.qml")); view->show(); #endif int result = app->exec(); delete view; delete app; return result; }
int main(int argc, char **argv) { QApplication app(argc, argv); QDeclarativeView view; view.engine()->addImageProvider("stockimages", new StockImageProvider()); view.setSource(QUrl::fromLocalFile("main.qml")); view.show(); return app.exec(); }
int main(int argc, char** argv) { QApplication app(argc, argv); QDeclarativeView view; codeography::qml::core::registerComponents(view); view.setSource(QUrl::fromLocalFile("exp01.qml")); view.setVisible(true); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); caml_main(argv); QDeclarativeView viewer; Gamemap map; viewer.rootContext() -> setContextProperty("gameMap",&map); viewer.setSource(QUrl("qml/main.qml")); viewer.show(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart"); QDeclarativeView view; view.setSource(QUrl::fromLocalFile("app.qml")); view.show(); return app.exec(); }
/** * Creates declarativeview which displays qml ui. moreover it's passing the gsm wrapper to the ui. */ int main(int argc, char *argv[]) { QApplication a(argc, argv); QDeclarativeView view; view.setSource(QUrl("qrc:/qml/start.qml")); view.setSceneRect(0,0,240,320); view.show(); view.rootContext()->setContextProperty("OfonoContext", new GSM()); return a.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); qmlRegisterType<ShareCommand>("ShareCommand", 1, 0, "ShareCommand"); QDeclarativeView view; view.setSource(QUrl("qrc:/qml/main.qml")); view.showFullScreen(); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { #ifdef MEEGO_EDITION_HARMATTAN QApplication *app = MDeclarativeCache::qApplication(argc, argv); QDeclarativeView *view = MDeclarativeCache::qDeclarativeView(); #else QApplication *app = new QApplication(argc, argv); QDeclarativeView *view = new QDeclarativeView(); QDeclarativeView *aboutview = new QDeclarativeView(); #endif #ifdef Q_WS_MAEMO_5 view->setAttribute(Qt::WA_Maemo5LandscapeOrientation); view->setAttribute(Qt::WA_Maemo5NonComposited); view->connect(view->engine(), SIGNAL(quit()), SLOT(close())); #endif // For QSettings QCoreApplication::setOrganizationName("AnttiPohjola"); QCoreApplication::setApplicationName("Nine Men's Morris"); /* #ifndef Q_WS_MAEMO_5 // Qt 4.7.0 doesn't have qsTrId() support in QML GConfClient *gconf = gconf_client_get_default(); QString locale = gconf_client_get_string(gconf, "/meegotouch/i18n/region", NULL); QTranslator translator; if (translator.load("qmuehle_" + locale, "/usr/share/l10n/meegotouch")) app->installTranslator(&translator); else qDebug() << "Failed to load translation" << ("/usr/share/l10n/meegotouch/qmuehle_" + locale +".qm"); #endif */ // Export the Game and Settings classes through the Muehle 1.0 QML module qmlRegisterType<Game>("Muehle", 1, 0, "Game"); qmlRegisterType<HistoryModel>("Muehle", 1, 0, "HistoryModel"); qmlRegisterType<Settings>("Muehle", 1, 0, "Settings"); view->setSource(QUrl("qrc:/qml/main.qml")); aboutview->setSource(QUrl("qrc:/qml/AboutPage.qml")); ViewController* controller = new ViewController(view, aboutview); //"image://myimageprovider/image.png" view->engine()->addImageProvider("boardicons", new BoardIconProvider()); // FIXME - for now, don't show fullscreen if screen height >= 800 or width >= 1024 /* QRect screenGeometry=QApplication::desktop()->screenGeometry(); if((screenGeometry.height()<800) && (screenGeometry.width()<1024)) view->showFullScreen(); else view->show(); */ view->showFullScreen(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char **argv) { QApplication *app = MDeclarativeCache::qApplication(argc, argv); QDeclarativeView *window = MDeclarativeCache::qDeclarativeView(); QDir::setCurrent(QCoreApplication::applicationDirPath()); window->setSource(QUrl::fromLocalFile("main.qml")); window->showFullScreen(); return app->exec(); }
//![0] int main(int argc, char *argv[]) { QApplication app(argc, argv); QDeclarativeView view; MyClass myClass; view.rootContext()->setContextProperty("myObject", &myClass); view.setSource(QUrl::fromLocalFile("MyItem.qml")); view.show(); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication app(argc, argv); QDeclarativeView view; TadaListEngine tdlEngine(view); view.rootContext()->setContextProperty("tdlObject", &tdlEngine); tdlEngine.loadView("qml/TadaList/main.qml"); return app.exec(); }
IconView::IconView(QAbstractItemModel *model, QWidget *parent) : QFrame(parent), m_model(model) { QDeclarativeView *view = new QDeclarativeView(this); QDeclarativeContext *ctxt = view->rootContext(); ctxt->setContextProperty("orderModel", m_model); ctxt->setContextProperty("sizeData", this); view->setSource(QUrl("qrc:IconView.qml")); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->setMargin(0); mainLayout->addWidget(view); setLayout(mainLayout); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); //![0] QDeclarativeView view; view.rootContext()->setContextProperty("currentDateTime", QDateTime::currentDateTime()); view.setSource(QUrl::fromLocalFile("MyItem.qml")); view.show(); //![0] return app.exec(); }
//![0] int main(int argc, char *argv[]) { QApplication app(argc, argv); QDeclarativeView view; ApplicationData data; view.rootContext()->setContextProperty("applicationData", &data); view.setSource(QUrl::fromLocalFile("MyItem.qml")); view.show(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); // Load settings QSettings settings; settings.setValue("dbtype", "QSQLITE"); settings.setValue("dbname", "/tmp/testdb.sqlite3"); // Translator QString translationfile = QString("qtmc_nl"); QTranslator translator; if (!translator.load(translationfile) && !translator.load(translationfile, app.applicationDirPath() + "../lib/qtmc/translations/")) { qWarning() << "Failed to load translation file"; } app.installTranslator(&translator); // Open database QSqlDatabase db = QSqlDatabase::addDatabase(settings.value("dbtype").toString()); db.setDatabaseName(settings.value("dbname").toString()); //db.setDatabaseName(":memory:"); // Check if database is open if (!db.open()) { qWarning() << app.tr("Cannot open database") << settings.value("dbname"); return 1; } // Create mediadb MediaDB *mediadb = new MediaDB(); qDebug() << app.tr("QtMC version") << QString(QTMC_VERSION); qDebug() << app.tr("MediaDB version") << mediadb->version(); // Create qml-view and connect quit-signal QDeclarativeView *view = new QDeclarativeView; QObject::connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); // Expose c++ object to qml QDeclarativeContext *ctxt = view->rootContext(); ctxt->setContextProperty("MediaDB", mediadb); ctxt->setContextProperty("Settings", &settings); // Run view view->setSource(QUrl(app.applicationDirPath() + "/../lib/qtmc/qml/QtMC.qml")); view->show(); //view->showFullScreen(); return app.exec(); }
MainWindow::MainWindow() { QDeclarativeView *view = new QDeclarativeView(this); view->rootContext()->setContextProperty( "installedGamesModel", GluonPlayer::GameManager::instance()->installedGamesModel() ); view->rootContext()->setContextProperty( "downloadableGamesModel", GluonPlayer::GameManager::instance()->downloadableGamesModel() ); view->rootContext()->setContextProperty( "serviceProvider", GluonPlayer::ServiceProvider::instance() ); view->rootContext()->setContextProperty( "mainWindow", this ); qmlRegisterType<GluonPlayer::GameMetadata>( "org.kde.gluon.playercomponents", 1, 0, "GameMetadata" ); qmlRegisterType<GluonPlayer::CommentItemsModel>( "org.kde.gluon.playercomponents", 1, 0, "CommentItemsModel" ); qmlRegisterUncreatableType<GluonPlayer::GameItem>( "org.kde.gluon.playercomponents", 1, 0, "GameItem", "To be used only for enums" ); qmlRegisterUncreatableType<GluonPlayer::GameDownloadJob>( "org.kde.gluon.playercomponents", 1, 0, "GameDownloadJob", "Get an instance from serviceProvider" ); m_kdeclarative.setDeclarativeEngine(view->engine()); m_kdeclarative.initialize(); m_kdeclarative.setupBindings(); view->setResizeMode(QDeclarativeView::SizeRootObjectToView); Plasma::Package *package = new Plasma::Package(QString(), "org.kde.gluon.player", Plasma::PackageStructure::load("Plasma/Generic")); view->setSource(QUrl(package->filePath("mainscript"))); setCentralWidget(view); resize(1024, 768); }
//![0] int main(int argc, char ** argv) { QApplication app(argc, argv); QDeclarativeView view; QDirModel model; view.rootContext()->setContextProperty("dirModel", &model); view.setSource(QUrl::fromLocalFile("view.qml")); view.show(); return app.exec(); }