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. PageStack.find and qml files pages [Solved]
Forum Updated to NodeBB v4.3 + New Features

PageStack.find and qml files pages [Solved]

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 2 Posters 5.2k 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.
  • C Offline
    C Offline
    cmer4
    wrote on last edited by
    #1

    Hi All,

    I use PageStack.find function without issues when I search for a page in the stack which was originating from the main file.
    But when a page is loaded from a separate file I seems to be missing the logic of what I should be doing to get proper response...

    @pageStack.push(Qt.resolvedUrl("content/Page1.qml"));
    console.log(pageStack.find(function(id) { return id == "page1id" }))@

    So basically after I pushed Page1 to the stack I want to use find function to get to know if it is there.
    What is the trick?

    Read the documentation and it is quite not getting clarity for me...

    1 Reply Last reply
    0
    • T Offline
      T Offline
      task_struct
      wrote on last edited by
      #2

      Hi,

      I suppose that page1id is inside Page1.qml, so I think that it is not visible.

      Edit: I found "this":http://doc.trolltech.com/4.8-snapshot/qdeclarativedocuments.html
      "Each id value in a QML document must be unique within that document. They do not need to be unique across different documents as id values are resolved according to the document scope."

      "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

      • Linu...
      1 Reply Last reply
      0
      • C Offline
        C Offline
        cmer4
        wrote on last edited by
        #3

        Hmm what should I do then to use pageStack.find to find these separate QML files? any advice?

        PS: thanks for expalining the reason though anyway!!

        1 Reply Last reply
        0
        • T Offline
          T Offline
          task_struct
          wrote on last edited by
          #4

          Based on "this example":http://doc.qt.nokia.com/qt-components-symbian-1.0/qml-pagestack.html#finding-a-page-in-the-stack I can suggest you to use some page identifiers. For example, add uid property to every PageN.qml.

          @
          pageStack.pop(pageStack.find(function(page) {
          return page.uid == "uid you want";
          }));
          @

          "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

          • Linu...
          1 Reply Last reply
          0
          • C Offline
            C Offline
            cmer4
            wrote on last edited by
            #5

            i will try that but how this uid will become visible as your previous post suggests this uid will also remain unseen for the pagestack?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              task_struct
              wrote on last edited by
              #6

              All properties of items are visible, only id is not. So you need some property that has unique value in every page.

              "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

              • Linu...
              1 Reply Last reply
              0
              • C Offline
                C Offline
                cmer4
                wrote on last edited by
                #7

                ahh got it. thanks a million. Solved

                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