mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 14:29:35 +02:00
Fix OverlayWindow loading issues
This commit is contained in:
parent
a8ec4bb844
commit
4d1c24abb7
2 changed files with 38 additions and 10 deletions
|
@ -19,12 +19,40 @@ Windows.Window {
|
||||||
property var channel;
|
property var channel;
|
||||||
// Don't destroy on close... otherwise the JS/C++ will have a dangling pointer
|
// Don't destroy on close... otherwise the JS/C++ will have a dangling pointer
|
||||||
destroyOnCloseButton: false
|
destroyOnCloseButton: false
|
||||||
property alias source: pageLoader.source
|
property var source;
|
||||||
|
property var component;
|
||||||
Loader {
|
property var dynamicContent;
|
||||||
id: pageLoader
|
onSourceChanged: {
|
||||||
objectName: "Loader"
|
if (dynamicContent) {
|
||||||
focus: true
|
dynamicContent.destroy();
|
||||||
property var dialog: root
|
dynamicContent = null;
|
||||||
}
|
}
|
||||||
} // dialog
|
component = Qt.createComponent(source);
|
||||||
|
console.log("Created component " + component + " from source " + source);
|
||||||
|
}
|
||||||
|
|
||||||
|
onComponentChanged: {
|
||||||
|
console.log("Component changed to " + component)
|
||||||
|
populate();
|
||||||
|
}
|
||||||
|
|
||||||
|
function populate() {
|
||||||
|
console.log("Populate called: dynamicContent " + dynamicContent + " component " + component);
|
||||||
|
if (!dynamicContent && component) {
|
||||||
|
if (component.status == Component.Error) {
|
||||||
|
console.log("Error loading component:", component.errorString());
|
||||||
|
} else if (component.status == Component.Ready) {
|
||||||
|
console.log("Building dynamic content");
|
||||||
|
dynamicContent = component.createObject(contentHolder);
|
||||||
|
} else {
|
||||||
|
console.log("Component not yet ready, connecting to status change");
|
||||||
|
component.statusChanged.connect(populate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: contentHolder
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ Fadable {
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
// The Window size is the size of the content, while the frame
|
// The Window size is the size of the content, while the frame
|
||||||
// decorations can extend outside it.
|
// decorations can extend outside it.
|
||||||
implicitHeight: content.height
|
implicitHeight: content ? content.height : 0
|
||||||
implicitWidth: content.width
|
implicitWidth: content ? content.width : 0
|
||||||
x: -1; y: -1
|
x: -1; y: -1
|
||||||
enabled: visible
|
enabled: visible
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue