Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2007

    Global variable problem with qml

    I have a problem with qml, i need to apply settings view (text color, font size) on other qml pages
    i tried the javascript global variable to be accessable for all pages but it couldn't be modified
    please tell me how to solve it

  2. #2
    Registered User
    Join Date
    Jan 2011

    Re: Global variable problem with qml

    have you moved all your global variables to a single JS file that starts with the line ".pragma library" ?

    Note also that changes to the JS variables do not automatically transfer to QML code that uses them. For example

    // In JS file
    .pragma library
    var someText = "ABCD"
    // in QML file
    import "global.js" as MyVariables
    Text  { text: MyVariables.someText }
    // in another QML file
    import "global.js" as MyVariables
    Timer { onTrigged: MyVariables.someText = "You will not see this" ; .... }
    the text is not automatically updated when "MyVariables.someText" changes. I have no idea why this limitation exists.

Similar Threads

  1. Global variable in js file to use in more QML files
    By AlterX in forum [Archived] Qt Quick
    Replies: 0
    Last Post: 2011-07-24, 10:48
  2. Global Variable - Implimentation
    By dilipsinh in forum Symbian
    Replies: 5
    Last Post: 2011-05-06, 11:51
  3. Replies: 9
    Last Post: 2010-03-12, 11:29
  4. Link error with global variable in CW for symbian
    By joe5160 in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2008-08-21, 09:42
  5. Global Variable problem in porting C code
    By avinniva in forum Symbian
    Replies: 2
    Last Post: 2006-08-10, 22:35

Posting Permissions

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