Provide keyboard in marketplaces window

This commit is contained in:
David Rowe 2016-11-03 09:00:40 +13:00 committed by Seth Alves
parent 550f796440
commit 196473f9fa
3 changed files with 26 additions and 13 deletions

View file

@ -11,9 +11,8 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtWebChannel 1.0
import QtWebEngine 1.1
import QtWebEngine 1.2
import QtWebSockets 1.0
import "qrc:///qtwebchannel/qwebchannel.js" as WebChannel
import "controls"
import "controls-uit" as Controls
@ -33,10 +32,6 @@ Rectangle {
property string claraMessage: "Choose a model and click Download -> Autodesk FBX."
property string claraError: "High Fidelity only supports Autodesk FBX models."
property bool keyboardEnabled: true
property bool keyboardRaised: true
property bool punctuationMode: false
onVisibleChanged: {
keyboardEnabled = HMD.active;
}
@ -49,6 +44,16 @@ Rectangle {
height: parent.height - statusBarHeight - keyboard.height
focus: true
webChannel.registeredObjects: [eventBridgeWrapper]
// Create a global EventBridge object for raiseAndLowerKeyboard.
WebEngineScript {
id: createGlobalEventBridge
sourceCode: eventBridgeJavaScriptToInject
injectionPoint: WebEngineScript.DocumentCreation
worldId: WebEngineScript.MainWorld
}
// Detect when may want to raise and lower keyboard.
WebEngineScript {
id: raiseAndLowerKeyboard
@ -57,7 +62,7 @@ Rectangle {
worldId: WebEngineScript.MainWorld
}
userScripts: [ raiseAndLowerKeyboard ]
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard ]
Timer {
id: alertTimer

View file

@ -2,9 +2,8 @@
import QtQuick 2.3
import QtQuick.Controls 1.4
import QtWebChannel 1.0
import QtWebEngine 1.1
import QtWebEngine 1.2
import QtWebSockets 1.0
import "qrc:///qtwebchannel/qwebchannel.js" as WebChannel
import "windows" as Windows
import "controls"
@ -23,10 +22,22 @@ Windows.Window {
// Don't destroy on close... otherwise the JS/C++ will have a dangling pointer
destroyOnCloseButton: false
property var source;
property var eventBridge;
property var component;
property var dynamicContent;
// Keyboard control properties in case needed by QML content.
property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false
// JavaScript event bridge object in case QML content includes Web content.
property alias eventBridge: eventBridgeWrapper.eventBridge;
QtObject {
id: eventBridgeWrapper
WebChannel.id: "eventBridgeWrapper"
property var eventBridge;
}
onSourceChanged: {
if (dynamicContent) {
@ -72,7 +83,6 @@ Windows.Window {
}
}
Item {
id: contentHolder
anchors.fill: parent

View file

@ -13,8 +13,6 @@
<link rel="stylesheet" type="text/css" href="css/edit-style.css">
<link rel="stylesheet" type="text/css" href="css/marketplaces.css">
<script src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script type="text/javascript" src="js/eventBridgeLoader.js"></script>
<script src="js/marketplaces.js"></script>
</head>
<body onload='loaded();'>