mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 08:03:27 +02:00
note: the idea is to make imports like 'import controlsUit 1.0' to work with 'styles-uit'/'controls-uit' it is not possible because of two reasons: 1. import controls-uit 1.0 is invalid syntax 2. qmldir inside controls-uit is 'module controlsUit'
62 lines
1.7 KiB
QML
62 lines
1.7 KiB
QML
import QtQuick 2.3
|
|
|
|
import "windows" as Windows
|
|
import "controls"
|
|
import controlsUit 1.0 as Controls
|
|
import "styles"
|
|
import stylesUit 1.0
|
|
|
|
Windows.Window {
|
|
id: root
|
|
HifiConstants { id: hifi }
|
|
title: "QmlWindow"
|
|
resizable: true
|
|
shown: false
|
|
focus: true
|
|
property var channel;
|
|
// Don't destroy on close... otherwise the JS/C++ will have a dangling pointer
|
|
destroyOnCloseButton: false
|
|
property var source;
|
|
property var dynamicContent;
|
|
|
|
// Keyboard control properties in case needed by QML content.
|
|
property bool keyboardEnabled: false
|
|
property bool keyboardRaised: false
|
|
property bool punctuationMode: false
|
|
|
|
onSourceChanged: {
|
|
if (dynamicContent) {
|
|
dynamicContent.destroy();
|
|
dynamicContent = null;
|
|
}
|
|
QmlSurface.load(source, contentHolder, function(newObject) {
|
|
dynamicContent = newObject;
|
|
});
|
|
}
|
|
|
|
// Handle message traffic from the script that launched us to the loaded QML
|
|
function fromScript(message) {
|
|
if (root.dynamicContent && root.dynamicContent.fromScript) {
|
|
root.dynamicContent.fromScript(message);
|
|
}
|
|
}
|
|
|
|
function clearDebugWindow() {
|
|
if (root.dynamicContent && root.dynamicContent.clearWindow) {
|
|
root.dynamicContent.clearWindow();
|
|
}
|
|
}
|
|
|
|
// Handle message traffic from our loaded QML to the script that launched us
|
|
signal sendToScript(var message);
|
|
onDynamicContentChanged: {
|
|
if (dynamicContent && dynamicContent.sendToScript) {
|
|
dynamicContent.sendToScript.connect(sendToScript);
|
|
}
|
|
}
|
|
|
|
Item {
|
|
id: contentHolder
|
|
anchors.fill: parent
|
|
}
|
|
}
|