mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 00:03:39 +02:00
saving work
This commit is contained in:
parent
715ee0b019
commit
865a78a8c8
5 changed files with 38 additions and 7 deletions
|
@ -90,7 +90,7 @@ Item {
|
|||
} else {
|
||||
breadcrumbText.text = "Menu";
|
||||
topMenu = null;
|
||||
//offscreenFlags.navigationFocused = false;
|
||||
offscreenFlags.navigationFocused = false;
|
||||
menuRoot.enabled = false;
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ Item {
|
|||
menuStack.push(newMenu);
|
||||
topMenu = newMenu;
|
||||
topMenu.focus = true;
|
||||
//offscreenFlags.navigationFocused = true;
|
||||
offscreenFlags.navigationFocused = true;
|
||||
}
|
||||
|
||||
function clearMenus() {
|
||||
|
|
|
@ -977,7 +977,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
connect(userInputMapper.data(), &UserInputMapper::actionEvent, [this](int action, float state) {
|
||||
using namespace controller;
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||
if (offscreenUi->navigationFocused()) {
|
||||
qDebug() << "NavigationFocused";
|
||||
auto actionEnum = static_cast<Action>(action);
|
||||
int key = Qt::Key_unknown;
|
||||
static int lastKey = Qt::Key_unknown;
|
||||
|
@ -1021,25 +1023,27 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
break;
|
||||
}
|
||||
|
||||
if (navAxis) {
|
||||
auto window = tabletScriptingInterface->getTabletWindow();
|
||||
if (navAxis && window) {
|
||||
qDebug() << "Sending input to qml";
|
||||
if (lastKey != Qt::Key_unknown) {
|
||||
QKeyEvent event(QEvent::KeyRelease, lastKey, Qt::NoModifier);
|
||||
sendEvent(offscreenUi->getWindow(), &event);
|
||||
sendEvent(window, &event);
|
||||
lastKey = Qt::Key_unknown;
|
||||
}
|
||||
|
||||
if (key != Qt::Key_unknown) {
|
||||
QKeyEvent event(QEvent::KeyPress, key, Qt::NoModifier);
|
||||
sendEvent(offscreenUi->getWindow(), &event);
|
||||
sendEvent(window, &event);
|
||||
lastKey = key;
|
||||
}
|
||||
} else if (key != Qt::Key_unknown) {
|
||||
if (state) {
|
||||
QKeyEvent event(QEvent::KeyPress, key, Qt::NoModifier);
|
||||
sendEvent(offscreenUi->getWindow(), &event);
|
||||
sendEvent(window, &event);
|
||||
} else {
|
||||
QKeyEvent event(QEvent::KeyRelease, key, Qt::NoModifier);
|
||||
sendEvent(offscreenUi->getWindow(), &event);
|
||||
sendEvent(window, &event);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -151,6 +151,8 @@ void Web3DOverlay::loadSourceURL() {
|
|||
|
||||
if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") {
|
||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||
auto flags = tabletScriptingInterface->getFlags();
|
||||
_webSurface->getRootContext()->setContextProperty("offscreenFlags", flags);
|
||||
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,20 @@ void TabletScriptingInterface::setQmlTabletRoot(QString tabletId, QQuickItem* qm
|
|||
}
|
||||
}
|
||||
|
||||
QQuickWindow* TabletScriptingInterface::getTabletWindow() {
|
||||
TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet("com.highfidelity.interface.tablet.system"));
|
||||
QObject* qmlSurface = tablet->getTabletSurface();
|
||||
OffscreenQmlSurface* surface = dynamic_cast<OffscreenQmlSurface*>(qmlSurface);
|
||||
QQuickWindow* window = surface->getWindow();
|
||||
return window;
|
||||
}
|
||||
|
||||
QObject* TabletScriptingInterface::getFlags()
|
||||
{
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
return offscreenUi->getFlags();
|
||||
}
|
||||
|
||||
//
|
||||
// TabletProxy
|
||||
//
|
||||
|
@ -200,6 +214,10 @@ void TabletProxy::addButtonsToHomeScreen() {
|
|||
QObject::disconnect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()));
|
||||
}
|
||||
|
||||
QObject* TabletProxy::getTabletSurface() {
|
||||
return _qmlOffscreenSurface;
|
||||
}
|
||||
|
||||
void TabletProxy::addButtonsToMenuScreen() {
|
||||
if (!_qmlTabletRoot) {
|
||||
return;
|
||||
|
|
|
@ -47,6 +47,10 @@ public:
|
|||
|
||||
void setQmlTabletRoot(QString tabletId, QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface);
|
||||
|
||||
QQuickWindow* getTabletWindow();
|
||||
|
||||
QObject* getFlags();
|
||||
|
||||
protected:
|
||||
std::mutex _mutex;
|
||||
std::map<QString, QSharedPointer<TabletProxy>> _tabletProxies;
|
||||
|
@ -112,6 +116,9 @@ public:
|
|||
*/
|
||||
Q_INVOKABLE void emitScriptEvent(QVariant msg);
|
||||
|
||||
|
||||
QObject* getTabletSurface();
|
||||
|
||||
signals:
|
||||
/**jsdoc
|
||||
* Signaled when this tablet receives an event from the html/js embedded in the tablet
|
||||
|
|
Loading…
Reference in a new issue