×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    13

    PageStackWindow (again), namespaces, and explicit visibility

    I am making progress with with PageStackWindow paradrigm, but am still uneasy that things are happening behind the scenes in a manner which I don't understand. I wonder if it might be easier to go back to the older Window paradigm until the documentation catches up.

    So I have main.qml:

    Code:
    PageStackWindow {
        id: rootWindow
    
        initialPage: MainPage {}
        showStatusBar: true
        showToolBar: true
    }
    which calls the component MainPage found in MainPage.qml.

    Now my understanding is that item ids are local to the file, and when you use components Qt simply instantiates an object which is in effect anonymous.

    Then in MainPage.qml, I have the following code, which is also straightforward:

    Code:
    Page {
        id: mainPage
        Text {
            anchors.centerIn: parent
            text: qsTr("Hello world!")
            color: platformStyle.colorNormalLight
            font.pixelSize: 20
        }
    
        tools: MainToolBarLayout {}
    }
    However, now in MainToolBarLayout.qml I need to be able to push and pop pages from the PageStack declared inside the PageStackWindow (this is from an example):

    Code:
    ToolBarLayout {
        id:toolBarLayoutMain
    
        ToolButton {
            iconSource: "toolbar-back"
            onClicked: pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
        }
    }
    So my question is why is the item pageStack visible inside ToolBarLayout? Is it considered a class variable? I really need to get a comfort level with namespaces.

    Can anyone point me in the right direction?
    Last edited by pavneetarora; 2012-02-20 at 01:41.

  2. #2
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: PageStackWindow (again), namespaces, and explicit visibility

    Hi,

    The pageStack item in PageStackWindow is like a container of pages in the stack based navigation model.

    Global variable pageStack is present in PageStack.js which is inturn imported into PageStack.qml (in the component definition qml)

    And hence its accessible.

    Please refer to code in gitorious -

    http://qt.gitorious.org/qt-component.../PageStack.qml

    http://qt.gitorious.org/qt-component...o/PageStack.js

Similar Threads

  1. PageStackWindow replace анимация.
    By HellStranger in forum Russian Developer Forum - Форум Российских разработчиков
    Replies: 1
    Last Post: 2011-12-14, 14:59
  2. Dealing with Namespaces - Flash Lite
    By jakeZ in forum [Archived] Flash Lite on Nokia Devices
    Replies: 1
    Last Post: 2009-04-09, 01:47
  3. Browsers and Bookmarks and Namespaces, oh my!
    By cdavies in forum Symbian C++
    Replies: 16
    Last Post: 2007-06-26, 12:14
  4. Namespaces in Symbian C++
    By uttumuttu in forum Symbian C++
    Replies: 0
    Last Post: 2006-07-28, 11:49
  5. namespaces and static data
    By earamsey in forum Symbian C++
    Replies: 1
    Last Post: 2004-09-28, 11:31

Posting Permissions

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