本文整理汇总了C++中QmlApplicationViewer::rootContext方法的典型用法代码示例。如果您正苦于以下问题:C++ QmlApplicationViewer::rootContext方法的具体用法?C++ QmlApplicationViewer::rootContext怎么用?C++ QmlApplicationViewer::rootContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QmlApplicationViewer
的用法示例。
在下文中一共展示了QmlApplicationViewer::rootContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
QFile file("D:\\pureclean.txt");
if (file.exists()){file.remove();}
//qInstallMsgHandler(myMessageHandler);
//QCoreApplication::setAttribute(Qt::AA_S60DisablePartialScreenInputMode, true);
QTranslator myTranslator;
myTranslator.load("bellecleaner_" + QLocale::system().name());
app.data()->installTranslator(&myTranslator);
//qt_s60_setPartialScreenAutomaticTranslation(false);
//qt_s60_setPartialScreenInputMode(true);
QmlApplicationViewer viewer;
qmlRegisterType<DeleteItem>("App", 1,0,"DeleteItem");
Application* a=new Application();
FileModel fileModel;
viewer.rootContext()->setContextProperty("fileModel", &fileModel);
viewer.rootContext()->setContextProperty("application",a);
//viewer.rootContext()->setContextProperty("mymodel",QVariant::fromValue(a->getCategoryModel()));
viewer.setMainQmlFile(QLatin1String("qml/PureClean/main.qml"));
viewer.showExpanded();
return app->exec();
}
示例2: QMainWindow
MuseBox::MuseBox(QWidget *parent) :
QMainWindow(parent)
{
//TODO add a splash screen here? would be totally fun!
qmlRegisterType<TrackArrangementBackground>("TrackArrangement",1,0,"TrackArrangementBackground");
qmlRegisterType<CursorRuler>("TrackArrangement",1,0,"CursorRuler");
qmlRegisterType<PatternModel>("DataModel",1,0,"PatternModel");
qmlRegisterType<NoteModel>("DataModel",1,0,"NoteModel");
qmlRegisterType<PatternDisplay>("TrackArrangement",1,0,"PatternDisplay");
qmlRegisterType<PatternNoteDisplay>("TrackArrangement",1,0,"PatternNoteDisplay");
QmlApplicationViewer *view = new QmlApplicationViewer();
view->rootContext()->setContextProperty("musebox", this);
view->rootContext()->setContextProperty("trackModel", &this->trackModel);
view->setSource(QUrl::fromLocalFile("qml/MuseBox/main.qml"));
view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
QGLFormat format = QGLFormat::defaultFormat();
format.setSampleBuffers(false);
QGLWidget *glWidget = new QGLWidget(format);
glWidget->setAutoFillBackground(false);
view->setViewport(glWidget);
setCentralWidget(view);
Hardware::Init();
view->rootContext()->setContextProperty("transposeMachine", Hardware::TransposeMachine);
Hardware::StartAudio();
}
示例3: main
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();
}
示例4: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> App(createApplication(argc, argv));
QTranslator Translator;
if (!Translator.load("tr_"+QLocale::system().name(), ":/i18n"))
Translator.load("tr_en", ":/i18n");
App->installTranslator(&Translator);
ConTranslator ConsoleMsgs;
ConsoleMsgs.load("conmsgs", ":/i18n");
App->installTranslator(&ConsoleMsgs);
IconProvider::SetToCurrentSystemTheme();
Context Ctx(argc, argv);
ScopedIntercomHandler Intercom;
if (Ctx.IfExit())
return Intercom->GetExitCode();
{
ModesModel ModesList(Ctx.CheckMode(), Ctx.CheckMode()==RunModes::PRINT);
UsersModel UsersList(Ctx.GetTargetUser(), Ctx.CheckMode()==RunModes::PRINT);
DesktopModel AppList;
PswTools PassCheck;
QmlApplicationViewer Viewer;
qmlRegisterUncreatableType<RunModes>("com.lcferrum.hmtsu", 1, 0, "RunModes", "Exports RunModes enum to QML");
Viewer.engine()->addImageProvider("icon", new IconProvider()); //It is QDeclarativeEngine's responsibility to destroy added image providers
Viewer.rootContext()->setContextProperty("objModesList", &ModesList);
Viewer.rootContext()->setContextProperty("objUsersList", &UsersList);
Viewer.rootContext()->setContextProperty("objAppList", &AppList);
Viewer.rootContext()->setContextProperty("objContext", &Ctx);
Viewer.rootContext()->setContextProperty("objIntercom", &Intercom);
Viewer.rootContext()->setContextProperty("objPassCheck", &PassCheck);
Viewer.rootContext()->setContextProperty("HMTSU_VERSION_STRING", HMTSU_VERSION_STRING IF_DEBUG(" (DEBUG)"));
Viewer.rootContext()->setContextProperty("HMTSU_COPYRIGHT_STRING", HMTSU_COPYRIGHT_STRING);
Viewer.rootContext()->setContextProperty("CANCELED_EXIT_CODE", CANCELED_EXIT_CODE);
Viewer.rootContext()->setContextProperty("DENIED_EXIT_CODE", DENIED_EXIT_CODE);
Viewer.rootContext()->setContextProperty("NORMAL_EXIT_CODE", NORMAL_EXIT_CODE);
Viewer.rootContext()->setContextProperty("MAX_PSW_ATTEMPTS", MAX_PSW_ATTEMPTS);
Viewer.setSource(QUrl("qrc:/main.qml"));
Viewer.showExpanded();
App->exec();
}
Ctx.Run();
return Intercom->GetExitCode();
}
示例5: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QmlApplicationViewer viewer;
RomFilter filter; // = new RomFilter();
viewer.rootContext()->setContextProperty("romModel", filter.model());
viewer.rootContext()->setContextProperty("romFilter", &filter);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/qmlSelector/main.qml"));
viewer.showExpanded();
return app.exec();
}
示例6: main
//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();
}
示例7: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#if defined(Q_OS_SYMBIAN)
int platformId = 0;
#elif defined(Q_WS_MAEMO_5)
int platformId = 1;
#elif defined(Q_WS_MAEMO_6)
int platformId = 2;
#elif defined(QT_WS_SIMULATOR)
int platformId = 3;
#elif defined(QT_SIMULATOR)
int platformId = 4;
#elif defined(Q_OS_MAC64)
int platformId = 5;
#elif defined(Q_WS_MEEGO)
int platformId = 6;
#else
// desktop probably
int platformId = 99;
#endif
QScopedPointer<QApplication> app(createApplication(argc, argv));
QmlApplicationViewer viewer;
viewer.rootContext()->setContextProperty("platform", platformId);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/landedsettings21/main.qml"));
viewer.showExpanded();
return app->exec();
}
示例8: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
app.data()->setOrganizationName("sardini");
app.data()->setApplicationName("freeboxremote");
Style style;
SettingsManager settingsManager;
QmlApplicationViewer viewer;
viewer.rootContext()->setContextProperty("STYLE", &style);
viewer.rootContext()->setContextProperty("SETTINGS_MANAGER", &settingsManager);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/main.qml"));
viewer.showExpanded();
return app->exec();
}
示例9: initialize
void TemplateManager::initialize(QmlApplicationViewer& viewer, const QString& modelName, FriendsManager* friendManager) {
Manager::initialize(viewer, modelName);
connectWithFriendManager(friendManager);
//настроить фильр
tuneFilterProxy();
//зарегистрировать фильтр
viewer.rootContext()->setContextProperty(modelName + "Proxy", templateFilterProxy);
}
示例10: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
ImageProvider engine;
QmlApplicationViewer viewer;
viewer.rootContext()->setContextProperty("imageengine",(QObject*)&engine);
viewer.engine()->addImageProvider(QLatin1String("sortedimages"),&engine);
viewer.setMainQmlFile(QLatin1String("qml/Imagesort/main.qml"));
viewer.showExpanded();
return app->exec();
}
示例11: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setApplicationName("imgrup");
app.setApplicationVersion("0.0.4a");
app.setOrganizationName("ZogG");
Upload upload_img;
Gallery gallery_req;
Tools extra_tools;
QmlApplicationViewer viewer;
// viewer.setResizeMode(QmlApplicationViewer::SizeRootObjectToView);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
viewer.rootContext()->setContextProperty("uploader",&upload_img);
viewer.rootContext()->setContextProperty("gallery_req",&gallery_req);
viewer.rootContext()->setContextProperty("shareit",&extra_tools);
QResource::registerResource("imgrup.qrc");
viewer.setMainQmlFile(QLatin1String("qml/imgrup/main.qml"));
viewer.showExpanded();
return app.exec();
}
示例12: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
ServerComm sc;
QmlApplicationViewer viewer;
viewer.rootContext()->setContextProperty("serverComm", &sc);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/CuteSoma/main.qml"));
viewer.showExpanded();
return app->exec();
}
示例13: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
QmlApplicationViewer viewer;
QDeclarativeContext *ctxt = viewer.rootContext();
ctxt->setContextProperty("KipptConnector", new KipptConnector());
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/klippr/main.qml"));
viewer.showExpanded();
return app->exec();
}
示例14: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QmlApplicationViewer viewer;
QDirModel model;
viewer.rootContext()->setContextProperty( "dirModel", &model);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/qdirmodel/main.qml"));
viewer.showExpanded();
return app.exec();
}
示例15: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
MusicShaker *shaker = new MusicShaker();
qWarning() << shaker;
QmlApplicationViewer viewer;
viewer.rootContext()->setContextProperty("shaker", shaker);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/musicshaker/main.qml"));
viewer.showExpanded();
return app->exec();
}