mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 13:33:26 +02:00
testing context passing to dockWidget via whitelisting.
This commit is contained in:
parent
257ac12bf9
commit
bd88a68a0f
3 changed files with 22 additions and 1 deletions
interface/src/ui
libraries/ui/src/ui
|
@ -111,6 +111,14 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
|||
auto quickView = _dockWidget->getQuickView();
|
||||
Application::setupQmlSurface(quickView->rootContext(), true);
|
||||
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
// Build the event bridge and wrapper on the main thread
|
||||
auto context = offscreenUi->widgetContextForUrl(sourceUrl);
|
||||
|
||||
|
||||
if(context!=nullptr){
|
||||
_dockWidget->getQuickView()->rootContext()->setContextObject(context);
|
||||
}
|
||||
/**jsdoc
|
||||
* Configures how a <code>NATIVE</code> window is displayed.
|
||||
* @typedef {object} InteractiveWindow.PresentationWindowInfo
|
||||
|
|
|
@ -307,6 +307,18 @@ void OffscreenQmlSurface::onRootContextCreated(QQmlContext* qmlContext) {
|
|||
#endif
|
||||
}
|
||||
|
||||
QQmlContext* OffscreenQmlSurface::widgetContextForUrl(const QUrl& url) {
|
||||
|
||||
// Get any whitelist functionality
|
||||
QList<QmlContextCallback> callbacks = getQmlWhitelist()->getCallbacksForUrl(url);
|
||||
// If we have whitelisted content, we must load a new context
|
||||
if(callbacks.empty()){
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return contextForUrl(url,nullptr, false);
|
||||
}
|
||||
|
||||
QQmlContext* OffscreenQmlSurface::contextForUrl(const QUrl& qmlSource, QQuickItem* parent, bool forceNewContext) {
|
||||
// Get any whitelist functionality
|
||||
QList<QmlContextCallback> callbacks = getQmlWhitelist()->getCallbacksForUrl(qmlSource);
|
||||
|
|
|
@ -36,7 +36,8 @@ public:
|
|||
Q_INVOKABLE void lowerKeyboard();
|
||||
PointerEvent::EventType choosePointerEventType(QEvent::Type type);
|
||||
Q_INVOKABLE unsigned int deviceIdByTouchPoint(qreal x, qreal y);
|
||||
|
||||
QQmlContext* widgetContextForUrl(const QUrl& url);
|
||||
|
||||
signals:
|
||||
void focusObjectChanged(QObject* newFocus);
|
||||
void focusTextChanged(bool focusText);
|
||||
|
|
Loading…
Reference in a new issue