mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:07:58 +02:00
Merge pull request #15633 from amerhifi/master
BUGZ 220: Docked Widget Whitelisting
This commit is contained in:
commit
9b26f70e2f
3 changed files with 18 additions and 3 deletions
|
@ -109,7 +109,11 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
||||||
auto mainWindow = qApp->getWindow();
|
auto mainWindow = qApp->getWindow();
|
||||||
_dockWidget = std::shared_ptr<DockWidget>(new DockWidget(title, mainWindow), dockWidgetDeleter);
|
_dockWidget = std::shared_ptr<DockWidget>(new DockWidget(title, mainWindow), dockWidgetDeleter);
|
||||||
auto quickView = _dockWidget->getQuickView();
|
auto quickView = _dockWidget->getQuickView();
|
||||||
Application::setupQmlSurface(quickView->rootContext(), true);
|
|
||||||
|
Application::setupQmlSurface(quickView->rootContext() , true);
|
||||||
|
|
||||||
|
//add any whitelisted callbacks
|
||||||
|
OffscreenUi::applyWhiteList(sourceUrl, quickView->rootContext());
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Configures how a <code>NATIVE</code> window is displayed.
|
* Configures how a <code>NATIVE</code> window is displayed.
|
||||||
|
@ -150,6 +154,8 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_dockWidget->setSource(QUrl(sourceUrl));
|
_dockWidget->setSource(QUrl(sourceUrl));
|
||||||
|
|
||||||
|
|
||||||
mainWindow->addDockWidget(dockArea, _dockWidget.get());
|
mainWindow->addDockWidget(dockArea, _dockWidget.get());
|
||||||
} else {
|
} else {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
|
|
@ -307,6 +307,13 @@ void OffscreenQmlSurface::onRootContextCreated(QQmlContext* qmlContext) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OffscreenQmlSurface::applyWhiteList(const QUrl& url, QQmlContext* context) {
|
||||||
|
QList<QmlContextCallback> callbacks = getQmlWhitelist()->getCallbacksForUrl(url);
|
||||||
|
for(const auto& callback : callbacks){
|
||||||
|
callback(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -26,7 +26,8 @@ public:
|
||||||
|
|
||||||
static void addWhitelistContextHandler(const std::initializer_list<QUrl>& urls, const QmlContextCallback& callback);
|
static void addWhitelistContextHandler(const std::initializer_list<QUrl>& urls, const QmlContextCallback& callback);
|
||||||
static void addWhitelistContextHandler(const QUrl& url, const QmlContextCallback& callback) { addWhitelistContextHandler({ { url } }, 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 isFocusText() const { return _focusText; }
|
||||||
bool getCleaned() { return _isCleaned; }
|
bool getCleaned() { return _isCleaned; }
|
||||||
|
|
||||||
|
@ -36,7 +37,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);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void focusObjectChanged(QObject* newFocus);
|
void focusObjectChanged(QObject* newFocus);
|
||||||
void focusTextChanged(bool focusText);
|
void focusTextChanged(bool focusText);
|
||||||
|
|
Loading…
Reference in a new issue