Hey there,
i guess the title is not really self-explaining, so i’ll try to explain.
I have two qml-files, a Level.qml and a Level02.qml.
In my Level.qml is a Loader:
Loader {
anchors.fill: parent
id: levelLoader;
onLoaded: {gameWindow.loadItemWithCocos(item);
....
}
onSourceChanged: { ... }
}
the source gets set in the main.qml.
The Problem is: as long as i don’t set the width and height of the Level.qml, nothing will get shown.
But the correct width and height depends on the e.g. Level02.qml. It can be different from level to level. (so Level03.qml has another width and height than Level02.qml)
How can i set the width and height of Level.qml accordingly to the loaded level??
things like:
property variant levelItem: levelLoader.item
width: levelItem.width
height: levelItem.height
or
onLoaded: {gameWindow.loadItemWithCocos(item);
level.width = item.width;
level.height = item.height;
levelItem = item;
}
onSourceChanged: {
// space_ship_x = 150;
// space_ship_y = 150;
level.width = item.width;
level.height = item.height;
levelItem = item;
}
didn’t really work out. hoping for help…
Cheers,
TS