Forums

OverviewV-Play 1 Support › Setting loaded item's width and height to calling item

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4475

    Thomas

    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

    #4519

    Christian
    V-Play Team

    Hi Thomas,

    did you already figure out a solution?

    Cheers, Chris

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support