本文整理汇总了C++中QtQuick2ApplicationViewer::rootContext方法的典型用法代码示例。如果您正苦于以下问题:C++ QtQuick2ApplicationViewer::rootContext方法的具体用法?C++ QtQuick2ApplicationViewer::rootContext怎么用?C++ QtQuick2ApplicationViewer::rootContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QtQuick2ApplicationViewer
的用法示例。
在下文中一共展示了QtQuick2ApplicationViewer::rootContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDir::setCurrent(QCoreApplication::applicationDirPath());
App application;
qmlRegisterType<App>("App", 1, 0, "App");
qmlRegisterType<CollectionModel>("CollectionModel", 1, 0, "CollectionModel");
qmlRegisterType<QStringListModel>("QStringListModel", 1, 0, "QStringListModel");
QtQuick2ApplicationViewer viewer;
viewer.rootContext()->setContextProperty("app", &application);
viewer.rootContext()->setContextProperty("checkModeCpp", &application.getCheckMode());
viewer.rootContext()->setContextProperty("dictionaryModeCpp", &application.getDictionaryMode());
viewer.rootContext()->setContextProperty("rememberModeCpp", &application.getRememberMode());
viewer.setMainQmlFile(QStringLiteral("qml/Learn/main.qml"));
viewer.showExpanded();
viewer.setIcon(QIcon(":/new/g/dictionary-icon.png"));
viewer.setTitle("Learn");
application.setWindow(&viewer);
return app.exec();
}
示例2: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLocalSocket localSocket;
localSocket.connectToServer("bloggerQml", QIODevice::ReadOnly);
if(localSocket.waitForConnected(5000))
{
// there is already an application running
qDebug() << "Application is already running.";
QMessageBox::information(0, QObject::tr("Erro"), QObject::tr("A aplicação já está a ser executada."), QMessageBox::Ok);
return 0;
}
QLocalServer localServer;
localServer.listen("bloggerQml");
BloggerLoader bloggerloader;
bloggerloader.loadBlogsFromFile();
BloggerProxyModel model;
model.setSourceModel(bloggerloader.model());
Helper helper;
QtQuick2ApplicationViewer viewer;
viewer.rootContext()->setContextProperty("blogsModel", &model);
viewer.rootContext()->setContextProperty("helper", &helper);
viewer.rootContext()->setContextProperty("bloggerloader", &bloggerloader);
viewer.setMainQmlFile(QStringLiteral("qml/blogerQML/main.qml"));
viewer.showExpanded();
int res = app.exec();
bloggerloader.saveDB();
return res;
}
示例3: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
//Logic logic(":/aggettivi.txt", viewer.rootContext());
Logic logic(":/indeterminativo", viewer.rootContext());
ExerciseVocabularyAnswer vocabulary(":/parole.txt");
TwoSetExercise set;
set.load("/tmp/sets.xml");
set.print();
viewer.rootContext()->setContextProperty("logic", &logic);
viewer.rootContext()->setContextProperty("vocabulary", &vocabulary);
viewer.rootContext()->setContextProperty("setexercise", &set);
//viewer.addImportPath("qml/educazionik-framework/");
viewer.setMainQmlFile(QStringLiteral("qml/educazionik-framework/main.qml"));
viewer.showExpanded();
return app.exec();
}
示例4: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");
Configuration m_configuration;
SerialLink m_serialLink;
MavLinkManager m_mavlink_manager;
LinkManager m_gLinkManager;
QtQuick2ApplicationViewer viewer;
QtQuick2ApplicationViewer splashscreen;
QString customPath = "Sqlite/OfflineStorage";
QDir dir;
if(dir.mkpath(QString(customPath))){
// qDebug() << "Default path >> "+viewer.engine()->offlineStoragePath();
viewer.engine()->setOfflineStoragePath(QString(customPath));
// qDebug() << "New path >> "+viewer.engine()->offlineStoragePath();
}
// using as normal
// viewer.setMainQmlFile(QStringLiteral("qml/gStabiSC/main.qml"));
// using qml files form resources file, uncomment this to compile all qml file to .exe
splashscreen.setSource(QUrl("qrc:/qml/gStabiSC/GSplashScreen.qml"));
splashscreen.setFlags(Qt::FramelessWindowHint);
splashscreen.setMinimumSize(QSize(1000,500));
splashscreen.show();
viewer.setSource(QUrl("qrc:/qml/gStabiSC/GMain.qml"));
viewer.setTitle(QString("%1 %2").arg(APPLICATION_NAME).arg(APPLICATION_VERSION));
viewer.setMinimumSize(QSize(APPLICATION_WIDTH,APPLICATION_HEIGHT));
viewer.setMaximumSize(QSize(APPLICATION_WIDTH,APPLICATION_HEIGHT));
// viewer.addImportPath("qrc:/qml/gStabiSC");
// viewer.addImportPath("qrc:/qml/gStabiSC/Components");
// viewer.addImportPath("qrc:/qml/gStabiSC/GDashboard");
// viewer.addImportPath("qrc:/javascript/storage.js");
viewer.rootContext()->setContextProperty("_configuration",&m_configuration);
viewer.rootContext()->setContextProperty("_serialLink", &m_serialLink);
viewer.rootContext()->setContextProperty("_mavlink_manager", &m_mavlink_manager);
m_gLinkManager.connectLink(&m_serialLink,&m_mavlink_manager);
QTimer::singleShot(3000, &splashscreen, SLOT(close()));
QTimer::singleShot(3000, &viewer, SLOT(show()));
return app.exec();
}
示例5: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
Hash hash(viewer.rootContext());
viewer.rootContext()->setContextProperty("hash", &hash);
viewer.setMainQmlFile(QStringLiteral("qrc:/qml/pasgen/main.qml"));
viewer.showExpanded();
return app.exec();
}
示例6: main
int main(int argc, char * argv[])
{
qsrand(QTime::currentTime().msec());
qmlRegisterType<QmlMapInterface>("DumbHome", 1, 0, "QmlMapInterface");
qmlRegisterType<MapObjectQmlWrapper>("DumbHome", 1, 0, "MapObjectQmlWrapper");
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qmlsrc/code-if-wanna-live/main.qml"));
viewer.showExpanded();
Map * const map = createMap();
World world(map, new MapPhysics(*map));
PlayerActionsQmlReceiver playerActionsQmlReceiver(world.getMap());
viewer.rootContext()->setContextProperty("playerActionsReceiver", &playerActionsQmlReceiver);
QmlMapInterface * const qmlMapInterface =
viewer.rootObject()->findChild<QmlMapInterface*>("qmlMapInterface");
if (qmlMapInterface != nullptr)
{
qmlMapInterface->setMap(world.getMap());
world.getMapPhysics().addListener(*qmlMapInterface);
}
return app.exec();
}
示例7: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
VideosDatabase *db = new VideosDatabase;
viewer.rootContext()->setContextProperty("videosDB", db);
viewer.setMainQmlFile(QStringLiteral("qml/app/qtquick20/main.qml")); // MAINQML
viewer.showFullScreen();
return app.exec();
}
示例8: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
FishManager* fishManager = new FishManager(&app);
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/FishRandomizer/main.qml"));
viewer.showExpanded();
viewer.rootContext()->setContextProperty("fishManager",fishManager);
qmlRegisterType<Fish>("Fishes",1,0,"FishObj");
return app.exec();
}
示例9: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
CommHandler comm;
ColorModel model;
QtQuick2ApplicationViewer viewer;
viewer.rootContext()->setContextProperty("comm", &comm);
viewer.rootContext()->setContextProperty("model", &model);
viewer.setMainQmlFile(QStringLiteral("qml/QtLight/main.qml"));
viewer.showExpanded();
#ifdef Q_OS_UNIX
qDebug() << "You are on Unix";
#endif
#ifdef Q_OS_WIN
qDebug() << "You are on Windows";
#endif
return app.exec();
}
示例10: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
NestedListModel* platforms = new NestedListModel(new UPlatform);
UPlatform* platform1 = createPlatform(platforms, 1);
UPlatform* platform2 = createPlatform(platforms, 2);
UPlatform* platform3 = createPlatform(platforms, 3);
ListModel* devices1 = platform1->nestedModel();
ListModel* devices2 = platform2->nestedModel();
ListModel* devices3 = platform3->nestedModel();
UDevice* device1 = createDevice(devices1, 1);
UDevice* device2 = createDevice(devices2, 2);
UDevice* device3 = createDevice(devices3, 3);
ListModel* scenarios1 = device1->nestedModel();
ListModel* scenarios2 = device2->nestedModel();
ListModel* scenarios3 = device3->nestedModel();
UScenario* scenario1 = createScenario(scenarios1, 1);
UScenario* scenario2 = createScenario(scenarios2, 2);
UScenario* scenario3 = createScenario(scenarios3, 3);
ListModel* tasks1 = scenario1->nestedModel();
ListModel* tasks2 = scenario2->nestedModel();
ListModel* tasks3 = scenario3->nestedModel();
UTask* taks1 = createTask(tasks1, 1);
UTask* taks2 = createTask(tasks2, 2);
UTask* taks3 = createTask(tasks3, 3);
ListModel* conditions1 = taks1->nestedModel();
ListModel* conditions2 = taks2->nestedModel();
ListModel* conditions3 = taks3->nestedModel();
createCondition(conditions1, 1);
createCondition(conditions2, 2);
createCondition(conditions3, 3);
QQmlContext* ctxt = viewer.rootContext();
ctxt->setContextProperty("platformsModel", platforms);
viewer.setSource(QUrl("qrc:///main.qml"));
viewer.show();
return app.exec();
}
示例11: main
int main(int argc, char *argv[])
{
QCoreApplication::setOrganizationDomain("ecikowaty.com");
QCoreApplication::setOrganizationName("ecikowaty");
QApplication app(argc, argv);
Settings settings;
QtQuick2ApplicationViewer viewer;
ingonline::AccountInfoProvider accountInfoProvider;
AccountModel accountModel;
QObject::connect(&accountInfoProvider, &ingonline::AccountInfoProvider::balanceDataUpdated,
&accountModel, &AccountModel::replaceWith);
try
{
HistoryModel historyModel;
QObject::connect(&accountInfoProvider, &ingonline::AccountInfoProvider::historyDataUpdated,
&historyModel, &HistoryModel::replaceWith);
viewer.rootContext()->setContextProperty("accountInfoProvider", &accountInfoProvider);
viewer.rootContext()->setContextProperty("accountModel", &accountModel);
viewer.rootContext()->setContextProperty("historyModel", &historyModel);
viewer.rootContext()->setContextProperty("settings", &settings);
viewer.setMainQmlFile(QStringLiteral("qml/main.qml"));
viewer.showExpanded();
return app.exec();
}
catch (const std::runtime_error& e)
{
qCritical() << e.what();
return 1;
}
return 0;
}
示例12: main
int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
Utility::registerTypes();
qmlRegisterType<BarcodeObject>("KoboMan", 1, 0, "Barcode");
qmlRegisterType<BarcodeScanner>("KoboMan", 1, 0, "BarcodeScanner");
QtQuick2ApplicationViewer viewer;
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
viewer.addImportPath(QStringLiteral("assets:/imports"));
#else
viewer.addImportPath(QStringLiteral("imports"));
#endif
qDebug() << viewer.engine()->importPathList();
Utility::initialize(&viewer);
Theme::initialize(Theme::androidHoloLight());
BookListModel bookList;
viewer.rootContext()->setContextProperty("BookList", &bookList);
viewer.rootContext()->setContextProperty("Library", &Library::get());
viewer.setMainQmlFile(QStringLiteral("qml/koboman/main.qml"));
viewer.showExpanded();
return app.exec();
}
示例13: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
qmlRegisterType<MindCell>("org.ginosoft.qmlcomponents", 1, 0, "MindCell");
CellManager cellManager;
viewer.rootContext()->setContextProperty("cellManager", &cellManager);
viewer.setMainQmlFile(QStringLiteral("qml/DontMind/main.qml"));
viewer.showExpanded();
return app.exec();
}
示例14: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
Controller controller; //
QtQuick2ApplicationViewer viewer;
viewer.rootContext()->
setContextProperty("controller", &controller); //
viewer.installEventFilter(&controller);
viewer.setMainQmlFile(QStringLiteral("qml/QCloseConfirm/main.qml"));
viewer.showExpanded();
return app.exec();
}
示例15: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
Timekeeper timekeeper;
QtQuick2ApplicationViewer viewer;
timekeeper.nextWeek();
timekeeper.addEvent(QStringLiteral("Jotain"), 2, 2);
timekeeper.addEvent(QStringLiteral("Muuta"), 2, 3);
timekeeper.prevWeek();
viewer.rootContext()->setContextProperty("timekeeper", &timekeeper);
viewer.setMainQmlFile(QStringLiteral("qml/timekeeper/main.qml"));
viewer.setTitle(QStringLiteral("Timekeeper"));
viewer.showExpanded();
return app.exec();
}