Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Dynamic Object Management (Create, Delete, Create, ....)

Dynamic Object Management (Create, Delete, Create, ....)

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    malikaliabbas
    wrote on last edited by
    #1

    Hello All,

    I am in process to build a game using Qt and C++ for Meego. I have come across a scenario in which a box2d word is created and game get started. After quitting game, user go to the main menu and then as he want to play a new game. As user presses new game button and 'gamePage' (which is actually a Rectangle Element) is displayed. In this page I have to place box2d world again with initialized bodies. but in my case bodies in box2d world are in previous positions.

    So what I want is that every time new game starts new world should be created and will be placed in 'gamePage'.

    I am using following box2d demo to build my game application 'http://projects.developer.nokia.com/mototrialracer'

    I have used Loader and Component Elements but these didn't show required results.

    here are some code segments to give you more info about the matter.

    @

    MouseArea {
    anchors.fill : parent

    onPressed: {
    newGameImage.source = "menu_item_h.jpg"
    }

    onReleased: {
    newGameImage.source = "menu_item.jpg"
    }

    onClicked: {
    newGameImage.source = "menu_item.jpg"

    mainPage.opacity = 0.0
    gamePage.opacity = 1.0

    //gamePage.loadWorld()
    }
    }
    @

    above code segment is from file MainPage.qml

    following is from file GamePage.qml

    @
    Component {
    id: worldComponent

    CarromWorld
    {
    id: world
    objectName: "worldObject"

    width: worldWidth
    height: worldHeight
    }
    }

    Loader {
    id: worldLoader

    sourceComponent : worldComponent

    onLoaded: {
    if(initCtrlElement)
    {
    console.log("World Loaded: "+ initCtrlElement)
    initControls()
    }
    }
    }@

    Kindly guide me.

    Regards,

    [edit: @ code tags added, Eddy]

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved