mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:58:03 +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
|
@ -111,6 +111,14 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
||||||
auto quickView = _dockWidget->getQuickView();
|
auto quickView = _dockWidget->getQuickView();
|
||||||
Application::setupQmlSurface(quickView->rootContext(), true);
|
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
|
/**jsdoc
|
||||||
* Configures how a <code>NATIVE</code> window is displayed.
|
* Configures how a <code>NATIVE</code> window is displayed.
|
||||||
* @typedef {object} InteractiveWindow.PresentationWindowInfo
|
* @typedef {object} InteractiveWindow.PresentationWindowInfo
|
||||||
|
|
|
@ -307,6 +307,18 @@ void OffscreenQmlSurface::onRootContextCreated(QQmlContext* qmlContext) {
|
||||||
#endif
|
#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) {
|
QQmlContext* OffscreenQmlSurface::contextForUrl(const QUrl& qmlSource, QQuickItem* parent, bool forceNewContext) {
|
||||||
// Get any whitelist functionality
|
// Get any whitelist functionality
|
||||||
QList<QmlContextCallback> callbacks = getQmlWhitelist()->getCallbacksForUrl(qmlSource);
|
QList<QmlContextCallback> callbacks = getQmlWhitelist()->getCallbacksForUrl(qmlSource);
|
||||||
|
|
|
@ -36,7 +36,8 @@ public:
|
||||||
Q_INVOKABLE void lowerKeyboard();
|
Q_INVOKABLE void lowerKeyboard();
|
||||||
PointerEvent::EventType choosePointerEventType(QEvent::Type type);
|
PointerEvent::EventType choosePointerEventType(QEvent::Type type);
|
||||||
Q_INVOKABLE unsigned int deviceIdByTouchPoint(qreal x, qreal y);
|
Q_INVOKABLE unsigned int deviceIdByTouchPoint(qreal x, qreal y);
|
||||||
|
QQmlContext* widgetContextForUrl(const QUrl& url);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void focusObjectChanged(QObject* newFocus);
|
void focusObjectChanged(QObject* newFocus);
|
||||||
void focusTextChanged(bool focusText);
|
void focusTextChanged(bool focusText);
|
||||||
|
|
Loading…
Reference in a new issue