int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QGuiApplication::setApplicationDisplayName(QCoreApplication::translate("main", "QtWebView Example")); #ifdef QT_WEBVIEW_WEBENGINE_BACKEND QtWebEngine::initialize(); #endif // QT_WEBVIEW_WEBENGINE_BACKEND QCommandLineParser parser; QCoreApplication::setApplicationVersion(QT_VERSION_STR); parser.setApplicationDescription(QGuiApplication::applicationDisplayName()); parser.addHelpOption(); parser.addVersionOption(); parser.addPositionalArgument("url", "The initial URL to open."); parser.process(app); const QString initialUrl = parser.positionalArguments().isEmpty() ? QStringLiteral("qt.io") : parser.positionalArguments().first(); QQmlApplicationEngine engine; QQmlContext *context = engine.rootContext(); context->setContextProperty(QStringLiteral("utils"), new Utils(&engine)); context->setContextProperty(QStringLiteral("initialUrl"), Utils::fromUserInput(initialUrl)); QRect geometry = QGuiApplication::primaryScreen()->availableGeometry(); if (!QGuiApplication::styleHints()->showIsFullScreen()) { const QSize size = geometry.size() * 4 / 5; const QSize offset = (geometry.size() - size) / 2; const QPoint pos = geometry.topLeft() + QPoint(offset.width(), offset.height()); geometry = QRect(pos, size); } context->setContextProperty(QStringLiteral("initialX"), geometry.x()); context->setContextProperty(QStringLiteral("initialY"), geometry.y()); context->setContextProperty(QStringLiteral("initialWidth"), geometry.width()); context->setContextProperty(QStringLiteral("initialHeight"), geometry.height()); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
int main(int argc, char* argv[]) { QApplication app(argc, argv); qRegisterMetaType<TreeViewModel>("TreeViewModel"); qRegisterMetaType<ConfigNode> ("ConfigNode"); qRegisterMetaType<UndoManager> ("UndoManager"); qRegisterMetaType<GUIBackend> ("GUIBackend"); qRegisterMetaType<GUISettings> ("GUISettings"); qmlRegisterType<DataContainer> ("org.libelektra.qtgui", 1, 0, "DataContainer"); QString locale = QLocale::system().name(); QTranslator translator; translator.load(QString(":/qml/i18n/lang_") + locale + QString(".qm")); app.installTranslator(&translator); QQmlApplicationEngine engine; QQmlContext* ctxt = engine.rootContext(); UndoManager manager; GUIBackend backend; GUISettings settings; TreeViewModel treeModel; engine.setObjectOwnership(&treeModel, QQmlApplicationEngine::CppOwnership); ctxt->setContextProperty("undoManager", &manager); ctxt->setContextProperty("externTreeModel", &treeModel); ctxt->setContextProperty("guiBackend", &backend); ctxt->setContextProperty("guiSettings", &settings); treeModel.populateModel(); engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; QQmlContext* context = engine.rootContext(); QString currPath = QDir::currentPath(); context->setContextProperty("currentPath", currPath); QScreen *screen = QApplication::screens().at(0); int width = screen->availableSize().width(); context->setContextProperty("availableWidth", width); int height = screen->availableSize().height(); context->setContextProperty("availableHeight", height); MainController* mainController = new MainController(); context->setContextProperty("mainController", mainController); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
int main(int argc, char *argv[]) { #ifdef Q_OS_LINUX // When using QAudioOutput on linux/ALSA, we need to // block SIGIO on all threads except the audio thread sigset_t set; sigemptyset(&set); sigaddset(&set, SIGIO); pthread_sigmask(SIG_BLOCK, &set, nullptr); #endif qSetMessagePattern("[%{if-debug}D%{endif}%{if-warning}W%{endif}" "%{if-critical}C%{endif}%{if-fatal}F%{endif}]" "%{if-category} [%{category}]:%{endif} %{message}"); QGuiApplication a(argc, argv); a.setApplicationName("Phoenix"); a.setApplicationVersion(PHOENIX_VERSION); a.setOrganizationName("Phoenix"); // a.setOrganizationDomain("phoenix-emu.org"); QSettings settings; qmlRegisterType<PhoenixWindow>("phoenix.window", 1, 0, "PhoenixWindow"); qmlRegisterType<CachedImage>("phoenix.image", 1, 0, "CachedImage"); qmlRegisterType<VideoItem>("phoenix.video", 1, 0, "VideoItem"); qmlRegisterType<GameLibraryModel>(); qmlRegisterType<PhoenixLibrary>("phoenix.library", 1, 0, "PhoenixLibrary"); qmlRegisterType<InputDeviceMapping>(); qmlRegisterType<InputDevice>(); qRegisterMetaType<retro_device_id>("retro_device_id"); qRegisterMetaType<int16_t>("int16_t"); qRegisterMetaType<InputDeviceEvent *>(); QQmlApplicationEngine engine; // first, set the context properties QQmlContext *rctx = engine.rootContext(); rctx->setContextProperty("inputmanager", &input_manager); // then, load qml and display the window engine.load(QUrl("qrc:/qml/main.qml")); QObject *topLevel = engine.rootObjects().value(0); PhoenixWindow *window = qobject_cast<PhoenixWindow *>(topLevel); window->setCacheDirectory(engine.offlineStoragePath() + "/"); window->show(); input_manager.scanDevices(); return a.exec(); }
int main(int argc, char *argv[]) { QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); QQmlContext *context = view->rootContext(); // This will hook into the view and render OpenGL on top of it ShaderToyGLView shaderToyView(view); context->setContextProperty("shaderToy", &shaderToyView); view->setSource(SailfishApp::pathTo("qml/shadertoy.qml")); view->show(); return app->exec(); }
void Controller::setQml(const QString &qmlfile, const QString &screenName) { QQmlContext *qmlcontext = qmlviewer->rootContext(); QString file = qmlfile; QString qmlfullpath = file.prepend(QML_PATH); const QUrl qmlurl(qmlfullpath); if(screenName != "settings") screenSettings->stopPreview(); qmlcontext->setContextProperty("activeScreen", screenName); QMetaObject::invokeMethod(qmlviewer, "setSource", Qt::QueuedConnection, Q_ARG(QUrl, qmlurl)); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; DataMethods methodsStopWatch("stopwatchResults.txt"); DataMethods methodsCountDown("countdownResults.txt"); //load stored results from .txt files to listViews of stopWatch and countDown sections methodsStopWatch.loadData(); methodsCountDown.loadData(); QQmlContext *ctxt = engine.rootContext(); //give access to saved models in .txt to stopWatch and countDown sections in QML ( used upon new sesion of program) ctxt->setContextProperty("myStopWatchModel",QVariant::fromValue(&methodsStopWatch)); ctxt->setContextProperty("myCountDownModel",QVariant::fromValue(&methodsCountDown)); //give option to manipulate ( add results and save/clear) .txt file with methods inside DataMethods ctxt->setContextProperty("saveStopWatchModel",QVariant::fromValue(&methodsStopWatch)); ctxt->setContextProperty("saveCountDownModel",QVariant::fromValue(&methodsCountDown)); engine.load(QUrl(QStringLiteral("qrc:/mainSW.qml"))); return app.exec(); }
void MarSystemControlView::recreate(Marsyas::MarSystem * system, QQmlComponent * delegate) { foreach(QObject * item, m_items) delete item; m_items.clear(); control_map_t controls = system->controls(); control_map_t::iterator it; for (it = controls.begin(); it != controls.end(); ++it) { cout << "a control: " << it->first << endl; const MarControlPtr & control = it->second; QString name = QString::fromStdString( control->getName() ); QVariant value; std::string type = control->getType(); if (type == "mrs_real") value = QString::number( control->to<mrs_real>() ); else if (type == "mrs_natural") value = QString::number( control->to<mrs_natural>() ); else if (type == "mrs_bool") value = QVariant( control->to<mrs_bool>() ).convert(QVariant::String); else if (type == "mrs_string") value = QString::fromStdString(control->to<mrs_string>()); else value = QString("<undefined>"); //value.convert(QVariant::String); QQmlPropertyMap *data = new QQmlPropertyMap; data->insert("name", name); data->insert("value", value); QQmlContext *context = new QQmlContext( delegate->creationContext() ); context->setContextProperty("control", data); QObject * object = delegate->create(context); context->setParent(object); m_items.append(object); QQuickItem *item = qobject_cast<QQuickItem*>(object); if (!item) return; item->setParentItem( this->parentItem() ); } }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; Buzzer theBuzzer; QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("Buzzer", &theBuzzer); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; Receiver receiver; QQmlContext* ctx = engine.rootContext(); ctx->setContextProperty("receiver", &receiver); engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); receiver.sendToQml(43); return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; UdpSeret * udpSeret = new UdpSeret(&app); udpExtraDataCACC * udpXDataCACC = new udpExtraDataCACC(&app); UDPSender * udpSender = new UDPSender(&app); UDPVehicle * udpVehicle=new UDPVehicle(&app); QQmlContext * rc = engine.rootContext(); rc->setContextProperty("udpSeret", udpSeret); rc->setContextProperty("udpXDataCACC", udpXDataCACC); rc->setContextProperty("udpSender",udpSender); rc->setContextProperty("udpVehicle",udpVehicle); qmlRegisterType<FileIO, 1>("FileIO", 1, 0, "FileIO"); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; QQmlContext *root = engine.rootContext(); DataBase *db = new DataBase(); root->setContextProperty("DataBase", db); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
void contextSetProperty(QQmlContext_ *context, QString_ *name, DataValue *value) { const QString *qname = reinterpret_cast<QString *>(name); QQmlContext *qcontext = reinterpret_cast<QQmlContext *>(context); QVariant var; unpackDataValue(value, &var); // Give qvalue an engine reference if it doesn't yet have one . QObject *obj = var.value<QObject *>(); if (obj && !qmlEngine(obj)) { QQmlEngine::setContextForObject(obj, qcontext); } qcontext->setContextProperty(*qname, var); }
void EffectsManager::removeEffect(int i) { qDebug() << "begin remove effect:"<<i; QQmlContext *ctxt = view.rootContext(); if (i<0 || i>=dataListLabels.length() || i>=dataListValues.length()) { qDebug() << "end remove effect"; return; } dataListValues.removeAt(i); qDebug() << "1"; dataListLabels.removeAt(i); qDebug() << "2"; ctxt->setContextProperty("myModel",dataListLabels); qDebug() << "end remove effect"; }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); qmlRegisterType<ChessController>("Chess", 1, 0, "ChessController"); ChessController chessController; QQmlApplicationEngine engine; QQmlContext *qmlcontext = engine.rootContext(); if (!qmlcontext) { qWarning() << "Cannot get QML context"; return 0; } qmlcontext->setContextProperty("chessController", &chessController); engine.load(QUrl(QStringLiteral("qml/main.qml"))); 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(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); #ifdef linux CPUTimer timer(CLOCK_PROCESS_CPUTIME_ID); #endif //![0] #if 1 // add precompiled files QQmlEngine *engine = view.engine(); QQmlEnginePrivate::get(engine)->v4engine()->iselFactory.reset(new QV4::JIT::ISelFactory); QmcLoader loader(engine); #ifdef linux timer.start(); #endif 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[]) { QCoreApplication::setApplicationName("harbour-sailseries"); QCoreApplication::setOrganizationName("harbour-sailseries"); qmlRegisterType<SeriesData>("harbour.sailseries.model", 1, 0, "SeriesData"); qmlRegisterType<SeriesListModel>("harbour.sailseries.model", 1, 0, "SeriesListModel"); qmlRegisterType<SearchListModel>("harbour.sailseries.model", 1, 0, "SearchListModel"); qmlRegisterType<TodayListModel>("harbour.sailseries.model", 1, 0, "TodayListModel"); qmlRegisterType<Engine>("harbour.sailseries.model", 1, 0, "engine"); qmlRegisterType<EpisodeData>("harbour.sailseries.model", 1, 0, "EpisodeData"); qmlRegisterType<EpisodeListModel>("harbour.sailseries.model", 1, 0, "EpisodeListModel"); qmlRegisterType<SeasonData>("harbour.sailseries.model", 1, 0, "SeasonData"); qmlRegisterType<SeasonListModel>("harbour.sailseries.model", 1, 0, "SeasonListModel"); qmlRegisterType<Statistics>("harbour.sailseries.model", 1, 0, "Statistics"); // For this example, wizard-generates single line code would be good enough, // but very soon it won't be enough for you anyway, so use this more detailed example from start QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv)); QScopedPointer<QQuickView> view(SailfishApp::createView()); // That is how you can access version strings in C++. And pass them on to QML view->rootContext()->setContextProperty("appVersion", APP_VERSION); view->rootContext()->setContextProperty("appBuildNum", APP_BUILDNUM); // This is the public QML datacontroller QScopedPointer<Engine> engine(new Engine); QQmlContext* context = view->rootContext(); context->setContextProperty("engine", engine.data()); Settings settings; view->rootContext()->setContextProperty("settings", &settings); // Here's how you will add QML components whenever you start using them // Check https://github.com/amarchen/Wikipedia for a more full example view->engine()->addImportPath(SailfishApp::pathTo("qml/components").toString()); view->setSource(SailfishApp::pathTo("qml/main.qml")); view->showFullScreen(); return app->exec(); }
int main(int argc, char **argv) { QGuiApplication app(argc, argv); // Déclaration de la vue QML QQuickView* view = new QQuickView(); Counter *c1 = new Counter(); // recuperation du context QQmlContext *ctxt = view->rootContext(); // liaison entre le BE et le FE ctxt->setContextProperty("myCounter", c1); view->setSource(QUrl("qrc:/main.qml")); // affichage view->show(); return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQuickView view; QQmlContext *context = view.rootContext(); context->setContextProperty(QStringLiteral("backgroundColor"), QColor(Qt::yellow)); KDeclarative::KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(view.engine()); kdeclarative.initialize(); //binds things like kconfig and icons kdeclarative.setupBindings(); view.setSource(QUrl::fromLocalFile(QFINDTESTDATA("test.qml"))); view.show(); return app.exec(); }
int main(int argc, char ** argv) { QGuiApplication app(argc, argv); //![0] QStringList dataList; dataList.append("Item 1"); dataList.append("Item 2"); dataList.append("Item 3"); dataList.append("Item 4"); QQuickView view; QQmlContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); //![0] view.setSource(QUrl("qrc:view.qml")); view.show(); return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQuickView view(QUrl("qrc:main.qml")); view.setResizeMode(QQuickView::SizeRootObjectToView); QQmlContext *ctxt = view.rootContext(); TicTacEngine dataObject; ctxt->setContextProperty("_myClass", &dataObject); QObject *button = view.rootObject(); QObject::connect(button, SIGNAL(qmlSignal(QVariant)), &dataObject, SLOT(reset(QVariant))); view.show(); return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); qmlRegisterType<QMinecraftGUIEditor>("MinecraftJSONEditor", 1, 0, "MinecraftGUIEditor"); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); QObject *rootObject = engine.rootObjects().first(); QQmlContext *qctx = engine.rootContext(); MinecraftJSONParser parser; parser.loadJSONFile("ui/_ui_defs.json"); parser.checkForMissingComponents(); qctx->setContextProperty("componentListModel", QVariant::fromValue(parser.getComponentNames())); QMinecraftGUIEditor* editor = rootObject->findChild<QMinecraftGUIEditor*>("gui_editor"); editor->setMinecraftJSONParser(&parser); return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QString filepath = app.arguments().value(1, "./why_are_you_reading_this.png"); filepath = QDir().absoluteFilePath(filepath); Comic comic; if (QFile(filepath).exists()) { comic.load(QImage(filepath)); } else { qDebug() << "File does not exist:" << filepath; } QtQuick2ApplicationViewer viewer; viewer.engine()->addImageProvider("comicimageprovider", new ComicImageProvider(comic)); QQmlContext* context = viewer.rootContext(); context->setContextProperty("comic", &comic); viewer.setMainQmlFile(QStringLiteral("qml/quick/main.qml")); viewer.showExpanded(); return app.exec(); }
TrackListPanel::TrackListPanel(const iscore::ApplicationContext &ctx): iscore::PanelDelegate{ctx}, m_widget{new QWidget}, m_trackModel(new TrackModel), m_layout{new QVBoxLayout}, m_containerpanel{new QMLContainerPanel} { m_trackModel->addTrack(Track(100, 0, 0)); QQuickWidget* container = m_containerpanel->container(); QQmlEngine* engine = container->engine(); QQmlContext* rootctxt = engine->rootContext(); rootctxt->setContextProperty(QString("trackModel"), m_trackModel); m_containerpanel->setSource(QString("qrc:/qml/TrackList.qml")); m_containerpanel->setContainerSize(m_containerpanel->size()); m_containerpanel->setObjectName("TrackList"); m_containerpanel->setBaseSize(m_widget->size()); m_layout->addWidget(m_containerpanel); m_widget->setLayout(m_layout); }
int main(int argc, char *argv[]) { QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv)); QScopedPointer<QQuickView> view(SailfishApp::createView()); Storage storage; storage.LoadFromFile("dupa.json"); Browser browser; QQmlContext* ctx = view->rootContext(); browser.setQmlContext(ctx); browser.updateList("fileList"); ctx->setContextProperty("storage", &storage); ctx->setContextProperty("browser", &browser); //view->engine()->addImportPath("qrc:/qml/"); view->setSource(QUrl(SailfishApp::pathTo("qml/primFTP.qml"))); view->showFullScreen(); return app->exec(); }
int main(int argc, char ** argv) { QGuiApplication app(argc, argv); QStringList s; s.append("1"); s.append("2"); s.append("2"); s.append("2"); s.append("2"); s.append("3"); QQuickView view; QQmlContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(s)); view.setSource(QUrl("qrc:view.qml")); view.show(); return app.exec(); }
void AbstractDataPlugin::handleViewportChange( const ViewportParams *viewport ) { QList<AbstractDataPluginItem*> orphane = d->m_delegateInstances.keys(); QList<AbstractDataPluginItem*> const items = d->m_model->items( viewport, numberOfItems() ); foreach( AbstractDataPluginItem* item, items ) { qreal x, y; Marble::GeoDataCoordinates const coordinates = item->coordinate(); bool const visible = viewport->screenCoordinates( coordinates.longitude(), coordinates.latitude(), x, y ); if ( !d->m_delegateInstances.contains( item ) ) { if ( !visible ) { // We don't have, but don't need it either. Shouldn't happen though as the model checks for it already. continue; } // Create a new QML object instance using the delegate as the factory. The original // data plugin item is set as the context object, i.e. all its properties are available // to QML directly with their names QQmlContext *context = new QQmlContext( qmlContext( d->m_delegate ) ); context->setContextObject( item ); QList<QByteArray> const dynamicProperties = item->dynamicPropertyNames(); foreach( const QByteArray &property, dynamicProperties ) { context->setContextProperty( property, item->property( property ) ); } QObject* component = d->m_delegate->create( context ); QQuickItem* newItem = qobject_cast<QQuickItem*>( component ); QGraphicsItem* graphicsItem = qobject_cast<QGraphicsItem*>( component ); if ( graphicsItem && newItem ) { graphicsItem->setParentItem( d->m_delegateParent ); } if ( newItem ) { d->m_delegateInstances[item] = newItem; } else { mDebug() << "Failed to create delegate"; continue; } } else if ( !visible ) {
bool Chimera_Win::onWindowAttached( FB::AttachedEvent *evt, FB::PluginWindowWin* w ) { vlc_open(); m_quickViewPtr.reset( new QQuickView ); m_quickViewPtr->setResizeMode( QQuickView::SizeRootObjectToView ); m_quickViewPtr->setProperty( "_q_embedded_native_parent_handle", WId( w->getHWND() ) ); m_quickViewPtr->setFlags( m_quickViewPtr->flags() | Qt::FramelessWindowHint ); QQmlContext* context = m_quickViewPtr->rootContext(); m_qmlVlcPlayer = new QmlVlcSurfacePlayerProxy( (vlc::player*)this, m_quickViewPtr.data() ); m_qmlVlcPlayer->classBegin(); context->setContextProperty( "vlcPlayer", QVariant::fromValue( m_qmlVlcPlayer ) ); process_startup_options(); m_quickViewPtr->setSource( getQmlSource() ); MoveWindow( (HWND)m_quickViewPtr->winId(), 0, 0, w->getWindowWidth(), w->getWindowHeight(), FALSE ); m_quickViewPtr->show(); return false; }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QString path("."); if (argc == 2) { path = argv[1]; } QtQuick2ApplicationViewer viewer; GitProject git; git.setCurrentPath(path); QQmlContext *context = viewer.rootContext(); context->setContextProperty("gGit", &git); viewer.setMainQmlFile(QStringLiteral("qml/GitGrown/main.qml")); viewer.showExpanded(); return app.exec(); }
int main(int argc, char* argv[]) { QApplication app(argc, argv); qDebug() << "library paths" << app.libraryPaths(); QQmlApplicationEngine engine; engine.addImportPath("libview"); // We must set the locale always to C as some tools won't work correctly without it. // e.g. decimal points will always be "." this way. QLocale::setDefault(QLocale::c()); qDebug() << "QLibrary" << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath); qDebug() << "QLibraryPrefix" << QLibraryInfo::location(QLibraryInfo::PrefixPath); qDebug() << "QLibraryLocation" << QLibraryInfo::location(QLibraryInfo::LibrariesPath); QtWebEngine::initialize(); PythonLoader pythonLoader{&app}; QObject* dice = pythonLoader.getObject("dice.main", "Dice"); if (!dice) { qDebug() << "Could not initialize the python core!"; return -1; } QQmlContext* context = engine.rootContext(); QVariant vEngine, vContext; vEngine.setValue(&engine); vContext.setValue(context); dice->setProperty("qmlEngine", vEngine); dice->setProperty("qmlContext", vContext); context->setContextProperty("dice", dice); engine.load(QUrl("libview/Window/main.qml")); app.topLevelWindows().first()->setIcon(QIcon("libview/Window/images/dice_logo_grey.svg")); return app.exec(); }