×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    3

    Problem with toggling between the states in QT

    I am a student who attended the Nokia Workshop .
    A few of us are working on developing a small game app.
    We started to work in Qt Creator
    And when we were trying to design a small user interface in Qt quick .
    We got stuck at a point.
    If we have a game menu how to navigate from Home screen to play area !!!


    We have 2 different images
    1)For Home Screen
    2)For Play Area
    So we will have to create 2 States in Qt Quick right???
    After we create the basic problem is that the old image in base state is getting copied to the new state State1
    How are we supposed to create a overall different new State with the different image as the background and allows us to have new fields??
    So we have to transit from Home screen to Play area in a State transition
    In the sense if we have a base state and State1 .
    How am i supposed to have only one image in Base State and a totally different image in State1.
    We're at the very basic level.
    We'd be very glad if someone provides us with a small tutorial and help us clear our doubt

  2. #2
    Registered User
    Join Date
    Jan 2009
    Location
    ભારત->ગુજરાત->ભાવનગર
    Posts
    279

    Re: Problem with toggling between the states in QT

    Quote Originally Posted by vivek.purushoth View Post
    I am a student who attended the Nokia Workshop .
    A few of us are working on developing a small game app.
    We started to work in Qt Creator
    And when we were trying to design a small user interface in Qt quick .
    We got stuck at a point.
    If we have a game menu how to navigate from Home screen to play area !!!


    We have 2 different images
    1)For Home Screen
    2)For Play Area
    So we will have to create 2 States in Qt Quick right???
    After we create the basic problem is that the old image in base state is getting copied to the new state State1
    How are we supposed to create a overall different new State with the different image as the background and allows us to have new fields??
    So we have to transit from Home screen to Play area in a State transition
    In the sense if we have a base state and State1 .
    How am i supposed to have only one image in Base State and a totally different image in State1.
    We're at the very basic level.
    We'd be very glad if someone provides us with a small tutorial and help us clear our doubt
    hi vivek,
    Well if you have two images and want to load one after other then no need to go for two state,just write array in javascript shown below..
    Code:
    var a=0 //Global Variable
    var hex1=new Array("0","1") // Global Array
    function pic() {
    return hex1[a]
    }
    here 0 and 1 are images names, now just import this javascript file into your main.qml( or whatever is your file name ) and call function pic() from qml file.
    Now this thing you can also do on a button click where at first startup 0 image is loaded and after button press 1 image is loaded.
    Last edited by mind_freak; 2011-06-06 at 20:04.
    Regards
    Viral Parmar

  3. #3
    Registered User
    Join Date
    May 2009
    Location
    Guatemala
    Posts
    186

    Re: Problem with toggling between the states in QT

    Quote Originally Posted by vivek.purushoth View Post
    I am a student who attended the Nokia Workshop .
    A few of us are working on developing a small game app.
    We started to work in Qt Creator
    And when we were trying to design a small user interface in Qt quick .
    We got stuck at a point.
    If we have a game menu how to navigate from Home screen to play area !!!


    We have 2 different images
    1)For Home Screen
    2)For Play Area
    So we will have to create 2 States in Qt Quick right???
    After we create the basic problem is that the old image in base state is getting copied to the new state State1
    How are we supposed to create a overall different new State with the different image as the background and allows us to have new fields??
    So we have to transit from Home screen to Play area in a State transition
    In the sense if we have a base state and State1 .
    How am i supposed to have only one image in Base State and a totally different image in State1.
    We're at the very basic level.
    We'd be very glad if someone provides us with a small tutorial and help us clear our doubt
    Take a look at the Loader element.

    Check this previous thread as well: How to call/load another QML file (a completely new screen) from QML ?
    -CarlosDL

  4. #4
    Registered User
    Join Date
    Sep 2007
    Posts
    25

    Re: Problem with toggling between the states in QT

    Hi vivek,

    In two way you can achieve this -

    1) Suppose you are using an Image element (say the id is 'canvas')to so the image of Home Screen. When your state changes from base state to State1, you set the source of the Image element with the play area Image (like canvas.source = "<play area image path>");

    2) You have a separate QML altogether for the play area. Now on the state change you Load the play area qml file using Loader element.

    Hope this will help you, in your game development...

    Regards,
    Sauvik Das

Similar Threads

  1. Toggling between (showing/hiding) controls in an AppUI
    By stuart_george in forum Symbian User Interface
    Replies: 1
    Last Post: 2010-05-27, 14:38
  2. sending rtttl in the united states
    By gregpaul in forum Smart Messaging
    Replies: 1
    Last Post: 2003-02-04, 03:02
  3. Bluetooth in the United States
    By Nokia_Archive in forum Bluetooth Technology
    Replies: 1
    Last Post: 2002-05-27, 18:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×