Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Sep 2011

    How ID references are scoped/interpreted in QML?

    This question might have gone to the "Qt beginners" section, but I hope to get an answer here even faster.

    I am confused about the semantics of QML's id references. Documentation says "id values are resolved according to the document scope" but it is not clear for me what this scope exactly is (is it "static" according to first initialization or "dynamic" according to particular instantiation).

    For example,
    * Suppose I have a QML file MyButton which refers to some id "component" inside.
    * I use MyButton in two different nested contexts. Once as follows:
    MyRootPage -> MyButtonContainer -> MyButton
    and once as follows:
    MyRootPage -> MyButton.
    (that is, I have a MyRootPage QML which instantiates a MyButtonContainer which instantiates a couple of MyButton's, but MyRootPage also instantiates a couple of "bare" MyButton's too).
    * Given that both MyRootPage and MyButtonContainer have the line "id: component" in them, how would the id reference "component" be interpreted inside each MyButton instance?

    Does "document scoping" mean now, that in the first case it will refer to a MyButtonContainer instance, and in the second case, to a MyRootPage instance?

    Thank you. An short authoritative answer like "yes, you understood things correctly" would suffice. A pointer to a written doc that explains that would be especially awesome.

  2. #2
    Registered User
    Join Date
    May 2009

    Re: How ID references are scoped/interpreted in QML?

    sound correct to me ... it bubble up and reference the first id found

    of course it is not good design to reference upper level id but it is quick and works
    Last edited by lucarocchi; 2011-11-05 at 19:40.
    Keep it simple, stupid
    borg - http://store.ovi.com/content/116105

Similar Threads

  1. References
    By ankit.panwar in forum Symbian
    Replies: 1
    Last Post: 2010-07-12, 06:52
  2. using url references in smil
    By KlaarMobileEntertainment in forum General Messaging
    Replies: 0
    Last Post: 2009-10-22, 12:49
  3. smil is rendered from interpreted smil or initial text
    By ismailc in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2009-07-07, 13:06
  4. undefined references
    By rpunskyy in forum Symbian
    Replies: 3
    Last Post: 2007-12-10, 17:19
  5. How is the Create MBM command interpreted
    By vardhman in forum Symbian
    Replies: 1
    Last Post: 2004-10-13, 09:57

Posting Permissions

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