Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor giedi1's Avatar
    Join Date
    Jul 2007
    Posts
    139
    Hello,
    I ve found many information how to pass parameter between to different qml pages which are in different qml files but I cannot figure out how to retrieve passed parameter.

    I am using this code to open page and pass parameter:
    Code:
            function loadPage(file, param) {
                var component = Qt.createComponent(file)
                if (component.status === Component.Ready) {
                    if (param !== "")
                        pageStack.push(component, {parameter: param});
                    else
                        pageStack.push(component);
                }
                else
                    console.log("Error loading: " + component.errorString());
            }
    How to retrieve parameter: param in opened page?

  2. #2
    Registered User kusumk's Avatar
    Join Date
    Sep 2011
    Posts
    449
    Hi,

    From documentation -

    pageStack.push(examplePage, { foo: bar, foz: baz });

    This pushes the examplePage onto the stack and set the foo property in the page to bar and the foz property to baz. This can be used both with component or item-based pages.

    in the examplePage.qml, in the Page element you should be accessing them with foo and foz.

  3. #3
    Registered User kallela's Avatar
    Join Date
    Nov 2011
    Posts
    5
    You have to define a property for the parameter on the Page you are loading. Something like this:

    Code:
    Page {
        id: testPage
    
        property string parameter
    
        Label {
            ...
            text: testPage.parameter
        }
        ...
    }
    So "parameter" is the name of the parameter here. Define the parameters you like as page properties with appropriate name and type.

  4. #4
    Regular Contributor giedi1's Avatar
    Join Date
    Jul 2007
    Posts
    139
    I ve found solution.
    For all new to QML it might be useful to know that foo and foz properties must be declared in examplePage

    property string foo;
    property string foz;

Similar Threads

  1. QE-passed applications (passed 5 days ago) not visible on OVI store
    By MTI500 in forum [Closed] Publishing to Nokia Store
    Replies: 4
    Last Post: 2009-09-03, 17:49
  2. how to retrieve saved pages (.wml pages)
    By karen_cat in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2005-01-30, 22:23
  3. retrieve IMSI parameter
    By ruper in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2003-05-07, 09:25
  4. Replies: 0
    Last Post: 2003-04-29, 15:59
  5. Replies: 0
    Last Post: 2003-04-29, 15:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved