コード例 #1
0
ファイル: phonion.cpp プロジェクト: creichert/phonion
void Phonion::launch(int index)
{
    App* app = _appModel->app(index);

    QQmlContext* context = app->context();
    if (!context) {
        context = new QQmlContext(_view->engine(), app);
    }

    app->launch(context, onion(), _notifier);

    /* Get the area which contains the app. */
    QObject* apparea = _view->rootObject()->findChild<QObject*>("apparea");

    /* Use an AppIncubator to prepare component to be injected into apparea.
     *
     * A new component is created each time the app is launched but the
     * context for the app is persistent.
     */
    AppIncubator incubator(qobject_cast<QQuickItem*>(apparea));

    QQmlComponent component(_view->engine(), QUrl(app->source()));
    component.create(incubator, context);

    _currentAppItem = QSharedPointer<QQuickItem>(qobject_cast<QQuickItem*>(incubator.object()));
}