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. RootContext method
Qt 6.11 is out! See what's new in the release blog

RootContext method

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 4.6k 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.
  • R Offline
    R Offline
    rockstar
    wrote on last edited by
    #1

    can any one briefly explain what will rootContext method do in QDeclaritiveView class ....

    I didn't understand what was written in documentation........

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      Please have look again at "QDeclarativeContext class references":http://developer.qt.nokia.com/doc/qt-4.8/qdeclarativeview.html#rootContext:

      bq. QDeclarativeContext * QDeclarativeView::rootContext () const
      This function returns the root of the context hierarchy. Each QML component is instantiated in a QDeclarativeContext. QDeclarativeContext's are essential for passing data to QML components. In QML, contexts are arranged hierarchically and this hierarchy is managed by the QDeclarativeEngine.

      What is bothering you in this description?

      http://anavi.org/

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #3

        ... and make sure that you've followed the documentation to "QDeclarativeContext":http://doc.qt.nokia.com/4.8-snapshot/qdeclarativecontext.html and "QDeclarativeEngine":http://doc.qt.nokia.com/4.8-snapshot/qdeclarativeengine.html, which contain a brief explanation of both.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rockstar
          wrote on last edited by
          #4

          bq. this function returns root of the context hierarchy....

          can u briefly explain this sentence.......

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lgeyer
            wrote on last edited by
            #5

            Different QDeclarativeContexts are organized the same way as QObjects are - as a tree. Each QDeclarativeContext has one parent context and n child contexts. As in every tree there is exactly one root element, which has n children, but no parent.

            As each QDeclarativeEngine has its own context tree each QDeclarativeEngine has its own root context element, which is automatically created and accessible through QDeclarativeEngine::rootContext(). See "The Context Hierarchy":http://doc.qt.nokia.com/4.8-snapshot/qdeclarativecontext.html#the-context-hierarchy.

            A "QDeclarativeContext":http://doc.qt.nokia.com/4.8-snapshot/qdeclarativecontext.html#details is used to pass data between QML and C++.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              rockstar
              wrote on last edited by
              #6

              thanks Lukas........

              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