Results 1 to 5 of 5

Thread: how to create static variable in java script

  1. #1
    Join Date
    Apr 2011
    Posts
    36
    Thanks
    3
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default how to create static variable in java script

    hi,

    my app some balloons with a text inside.

    i have to arrange them alphabetically.

    to do, i have to create a static array such that when ever a balloon is clicked,a signal from qml to .js deletes first element of array

    is it correct procedure?

    error: signal deletes the element but for every click new array is generating

    is there any other procedure to do?

    its urgent. any one please answer

    regards,
    hema

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: how to create static variable in java script

    If it's that urgent, you should consider posting on a JavaScript forum. Qt has nothing to do with JavaScript.

    For what it's worth, it sounds like you need a global variable, not a static one. But I loathe JavaScript, so I could be wrong.

  3. #3
    Join Date
    Apr 2011
    Posts
    36
    Thanks
    3
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to create static variable in java script

    hi,

    i gave a global variable in .js
    but, separate variable is getting created for every component. i need only one for whole app.

  4. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: how to create static variable in java script

    Like I said: go find a JavaScript forum. Your question has nothing to do with Qt.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to create static variable in java script

    Quote Originally Posted by hema View Post
    but, separate variable is getting created for every component.
    So by definition the variable is not global. There are no static variables in javascript. Make the variable a property of the global object and it will be global.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 4th August 2011, 11:37
  2. Auto login using java script
    By johnsoga in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2011, 11:06
  3. Running java script in QtWebKit makes GUI sluggish
    By calium in forum Qt Programming
    Replies: 0
    Last Post: 26th August 2010, 09:35
  4. Java Script on Qt4.5
    By kavinsiva in forum Newbie
    Replies: 1
    Last Post: 7th October 2009, 13:08
  5. Replies: 22
    Last Post: 8th October 2008, 13:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.