diff --git a/interface/src/ui/InteractiveWindow.cpp b/interface/src/ui/InteractiveWindow.cpp index 7ce8822209..7e8c176424 100644 --- a/interface/src/ui/InteractiveWindow.cpp +++ b/interface/src/ui/InteractiveWindow.cpp @@ -112,10 +112,8 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap Application::setupQmlSurface(quickView->rootContext() , true); - //add any whitelisted callbacks - auto offscreenUi = DependencyManager::get(); - offscreenUi->widgetContextForUrl(sourceUrl, quickView->rootContext()); + OffscreenUi::applyWhiteList(sourceUrl, quickView->rootContext()); /**jsdoc * Configures how a NATIVE window is displayed. diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 8be0ca6c84..ec0fad5ff0 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -307,15 +307,10 @@ void OffscreenQmlSurface::onRootContextCreated(QQmlContext* qmlContext) { #endif } -void OffscreenQmlSurface::widgetContextForUrl(const QUrl& url, QQmlContext* context) { - - // Get any whitelist functionality +void OffscreenQmlSurface::applyWhiteList(const QUrl& url, QQmlContext* context) { QList callbacks = getQmlWhitelist()->getCallbacksForUrl(url); - // If we have whitelisted content, we must load a new context - if(!callbacks.empty()){ - for(const auto& callback : callbacks){ - callback(context); - } + for(const auto& callback : callbacks){ + callback(context); } } diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.h b/libraries/ui/src/ui/OffscreenQmlSurface.h index de821da90b..8bb22a8c79 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.h +++ b/libraries/ui/src/ui/OffscreenQmlSurface.h @@ -26,7 +26,8 @@ public: static void addWhitelistContextHandler(const std::initializer_list& urls, const QmlContextCallback& callback); static void addWhitelistContextHandler(const QUrl& url, const QmlContextCallback& callback) { addWhitelistContextHandler({ { url } }, callback); }; - + static void applyWhiteList(const QUrl& url,QQmlContext* context); + bool isFocusText() const { return _focusText; } bool getCleaned() { return _isCleaned; } @@ -36,7 +37,7 @@ public: Q_INVOKABLE void lowerKeyboard(); PointerEvent::EventType choosePointerEventType(QEvent::Type type); Q_INVOKABLE unsigned int deviceIdByTouchPoint(qreal x, qreal y); - void widgetContextForUrl(const QUrl& url,QQmlContext* context); + signals: void focusObjectChanged(QObject* newFocus);