Push a page of .qml using C++ defines the Navigation pane.

If I have a navigation pane, as defined in C++...

nav =  qml->createRootObject();

How to push a page called page.qml? The only documentation I can find is to build the C++ page, that I don't intend to do. The purpose of the Page doesn't seem to have a constructor that takes a file as input qml Page, so I don't know how to create a Page object to him, pushing with the NavigationPane function-> push(Page*).

First, you must load the qml file and create the object on the page of the qml. Then push the page in the navigation pane.

This code can help you!

NavigationPane *nav_pane = new NavigationPane;

QmlDocument *qml = QmlDocument::create("asset:///MyListView.qml").parent(this);
Page *new_page = qml->createRootObject();
nav_pane->push(new_page);
app->setScene(nav_pane);

-Looks

Riadh

Tags: BlackBerry Developers

Similar Questions

  • Should what message I to listen to know when a page is in jumps from the navigation pane

    Hello

    Is there a signal on the level of the page that will tell me when a page is in jumps from the navigation pane.  I wish I could stop some it is made on the page when he jumped and no longer in background processing mode.

    Where would I best handle this? I know that there is an onPopTransitionEnded on the navigation pane, but I would prefer to deal with in the qml file if possible...

    Thank you

    You can use the property on the page and Cisse inside the onPushTransitionEnded / onPopTransitionEnded
    For example:

    Page{
        property bool isActive: false
        onIsActiveChanged:{
            If (isActive){
                // start processing
            }else{
                // stop processing
            }
        }
        ....
    }
    

    And

    onPushTransitionEnded: page.isActive = trueonPopTransitionEnded: page.isActive = false
    
  • Page 1 Page 2 without the navigation pane? (change cancel button)

    Hello..

    as the topic already explained

    How I click key 1 for example and it will again go page 2 without the navigation pane

    If I want to go back to page 1, simply click the Cancel button

    all of this sample code? Thank you

    Hi, I assume that https://developer.blackberry.com/native/reference/cascades/bb__cascades__qmlcontroldelegate.html is your choice.

    There is also an example provided by the developer of bb10 3rd part: http://www.hrbuckley.net/2014/05/segmented-control-option-change.html

  • Page is not pressed in the Navigation pane.

    In the root of my project main qml item is NavigationPane and have three elements of the child Page

    hand. QML

    import bb.cascades 1.0
    
    NavigationPane {
        id: navigationPane
        backButtonsVisible: true
        Page {
            id: firstPage
            Container {
                background: Color.Gray
                Label {
                    text: "First page"
                }
            }
        }
        Page {
            id: secondPage
            Container {
                id: secondContainer
                background: Color.Gray
                Label {
                    text: "Second page"
                }
                Button {                id: myBtn
                    text: "My Button"
                    topMargin: 20
                    onClicked: {       
    
    // Here i want to push third page                     //navigationPane.deprecatedPushQmlByString(childPath)
                    }
                }
            }
            paneProperties: NavigationPaneProperties {
                backButton: ActionItem {
                    title: "First page"
                    imageSource: "asset:///back.png"
                    onTriggered: {
                        navigationPane.popAndDelete();
                    }
                }
            }
        }
    
    // This is the Third Page 
        Page {
            id: thirdPage
            objectName: "myThirdPage"
            Container {
                id: thirdContainer
                background: Color.DarkGray
                Label {
                    text: "Third Page"
                }
            }
            paneProperties: NavigationPaneProperties {
                backButton: ActionItem {
                    title: "Second page"
                    imageSource: "asset:///back.png"
                    onTriggered: {
                        navigationPane.popAndDelete();
                    }
                }
            }
        }
        onTopChanged: {
            console.log("Top Is Changing");
        }
    }
    

    On the second page, there is a button (id: myBtn). By clicking on it, I want to push the third page (Page with id: thirdPage).

     


    How to use the method deprecatedPushQmlByString (childPath) to push a element on the page (if its possible that its operating instructions is to inflate a Qml file)

    Or the path of the page can also be supplied as a parameter, so it then how?

    I tried passing the id value and objectName of thirdPage in the method above, but failed (I know that isn't true).

    Best approach is to have the subsequent pages in article [] of the attachedObjects and use

    navigationPaneId.push (id of the page to push);

    and it will work

  • Add javascript to the page template to use in all the pages resource...

    ADF:11.1.2.1.0
    WebLogic: 10.3.5

    In the code source temlate I want to add:

    "" < af:resource type = 'javascript' source = '... / resources/scp.js "/ >

    SCP.js is the javascript library that have functions that we like to use on many web pages like letters, validations, etc etc.

    <? XML version = "1.0" encoding = "UTF - 8"? >
    < jsp:root xmlns:jsp = "http://java.sun.com/JSP/Page" version = "2.1".
    xmlns:f = "http://java.sun.com/jsf/core".
    xmlns:af = "http://xmlns.oracle.com/adf/faces/rich".
    xmlns:trh = "http://myfaces.apache.org/trinidad/html".
    xmlns:tr = "http://myfaces.apache.org/trinidad" >

    < jsp:directive.page contentType = text/html"; Charset = UTF - 8 "/ >
    "" < af:resource type = 'javascript' source = '... / resources/scp.js "/ >
    < var af:pageTemplateDef = "uploading" >
    ........
    < / af:pageTemplateDef >
    < / jsp:root >

    This is possible, or is not appropriate to add af:resource on model?

    Yes, this should work and should NOT have problems.
    We have a similar approach in our current project and it works as expected.

    Thank you
    Nini

  • navigting to the first page in the navigation pane

    I have an application that has a lot of pages... So when I navigate and access a page, based on some condiion I want to go to the first page... is it possible to do so. ?

    I use QML to create pages.

    -Thank you

    http://developer.BlackBerry.com/Cascades/reference/bb__cascades__navigationpane.html#function-Naviga... Looks like it would provide this feature.

  • Navigation pane: gesture of slide and corn pages

    I use the NavigationPane to manage the transiction from one application Page to the other.

    I have two questions for you:

    (1) I would like to know if it is possible to disable the gesture of slide to "pop" or close the Page by dragging it from left to right.

    (2) it would be nice also to avoid the "pop" of the image when the gesture of the slide is active and I slide to a left-hand page. If I want to go back to the page on the right, I need to push it again in the Navigation pane. Is it possible to avoid this? For example, if I have a 3 page I go to the right page and then back to left pages no matter how many times I do it. How can I achieve this?

    Thanks in advance

    There's no reason you can't have a launch a thumb to the back of the image or for that matter have a "Forward" ActionItem, both are possible.

    Allows you to recognize the signal OnTouch (unfortunately it is not GestureHandler for it yet) and push the page when the shot is from right to left.

    Why do you want to avoid the pop?
    I understand you not wanting to destroy the page and keep in memory for faster loading, but there is little to gain from popping is not page, does that remove the battery of the navigationPane. Push and popping of pages has little impact on the effectiveness, it is actually adding or deleting a pointer to a list.

    If I were you I would implement some sort of caching so that as you walk in both directions between the pages you keep say 5 in memory with two part and the other the power of images and destroy the rest outside of this cache. When you move one way or the other you asynchronously create page two pages far in this direction. In this way, reduce you the memory requirements and keep speed high.

  • Get the page property top of page on the navigation stack

    Hello world

    I have a navigation stack, and I push pages top (sometimes even several times the same page, just with a different content)

    The pages are custom pages

    Now I have the problem that I need to get a specific page in the foreground property, and the property must be referenced from the navigation pane

    so my code that looks like this:

    //****************
    //***CustomPage.qml
    //********
    import bb.cascades 1.2
    Page {
        property variant titleLabel
    
        Container {}
    }
    
    ///This code is in my navigation pane, in a function
    
    var top = navigationPane.top; //top is a custom page, CustomPage
    
    //how to reference top.titleLabel ?
    

    I can't put it, I can't get it. I guess it's because the top is an unknown class . How can I do?

    Ah, the joys of debugging :/

    Found the solution for my problem: restarted Momentics, restarted my debugging device, now it works as expected (and it costs my 3 hours of my life)

    Sorry for the inconvenience

  • How do the States applied to the navigation bar appears on every page

    Hello.

    I created the new States on my nav bar items in the master page with the associated behavior. States work very well on the master page, but when I go to other pages that have the navigation bar on the master page, States seem not deferred. Specifically, the hover and down and lower States do not appear on the navigation bar in the pages other than the captain. I was under the impression that if I created these States in the master on the navigation bar, they appear and work the same on all other pages. Is this correct? What I am doing wrong? What should I do?

    Thank you!

    You may need to assign an equal number of States at each page, so that

    images from the navigation bar to be displayed. It doesn't have to be something in these

    States, but they are necessary in order to reproduce the number of States

    in the navigation bar.

    HTH

    Jim Babbage

  • How to stop pushing him to a QML Page when already in this Page

    Hello

    Main.qml I have the following question of action menu that displays SettingsPage.qml.

    hand. QML:

    NavigationPane {
        id: nav
    
        ...
    
        Menu.definition: MenuDefinition {
            actions: [
    
                ...
    
                ActionItem {
                    title: "Settings"
                    onTriggered: {
                        console.log("entering settings page");
    
                        var settingsPage = settingspagedef.createObject();
                        Qt.nav.push(settingsPage);
                    }
                },
    
                ...
    
                ] // end of actions list
    
         } // end of MenuDefinition
    
        ....
    
        Page {
    
             ....
    
        }
    

    And the SettingsPage.qml is a QML file that contains only the item page (and not in a NavigationPane). Thus, in settings page, another page of settings is pushed on top of the current page of settings when you click the action item "Settings." How can I prevent pushing to SettingsPage.qml one another when there is already a settings page? Thanks in advance.

    I prefer to remove the knob to Settngs completely rather than turn it off when I do not want my user to have access to it. My application says the menu of application as follows:

    MenuDefinition {    id: appMenu
        settingsAction: _settingsAction
        helpAction: _helpAction
        attachedObjects: [
            SettingsActionItem {
                id: _settingsAction
                onTriggered: {
                }
            },
            HelpActionItem {
                id: _helpAction
                onTriggered: {
                }
            }
        ]
        actions: [
        ]
        function restoreSettingsAction() {
            settingsAction = _settingsAction;
        }
        function restoreHelpAction() {
            helpAction = _helpAction;
        }
    }
    

    Now of QML, you can do this:

    // ---Remove the application menu Settings button
    appMenu.settingsAction = null;
    
    // ---Restore the application menu Settings button
    appMenu.restoreSettingsAction();
    

    ... and you can do the same thing with the help button if you wish. Note that if you have any other button in your menu of the application they will probably move in the menu if you delete/restore buttons settings or help.

    burakk wrote:

    Yes, I mean the menu of the Application.

    Your code turns off the entire menu. What happens if I don't only want the settings menu option? I guess I have to disable the part of the action of the main.qml. Is there another way to achieve the QML (main.qml) other action element other than Qt object implementation?

    onCreationCompleted: {}
    QT.nav = nav;
    Qt.catList = categoriesList;

    }

  • How Home Page or the Navigation of TabbarPane pane defined in files different qml?

    I defined a TabbedPane as below but each tab, I want to show content "questions.qml" (it is a Navigation pane") and the file"stats.qml"instead of embed code in single file." So I was wondering how can I achieve that?

    TabbedPane {
        showTabsOnActionBar: true
        Tab {
            id: questions
            title: "Questions"
            description: "This tab will have questions in current hub"
        }
        Tab {
            id: stats
            title: "Stats"
        }
    }
    

    I found the solution on stackoverflow. http://StackOverflow.com/questions/14482089/how-to-attach-page-or-navigation-pane-in-TabbedPane-defi...

  • [ADF, JDev12.1.3] Which is the best way to define the properties of CIU/fragments of pages. Is the approach that I have used a good choice (for a beginner)?

    Hallo,

    in my app, that I have a lot of pages and fragments in which properties (for example rendered text, disabled, Selected,...), lots of user interface components must be set, before/when the page is displayed, depending on the session and pageFlow scope attributes.

    So far I have created for each page/one backingBean brought bean fragment in which I defined an attribute for each property defined (e.g. 2 properties for each UIC: UIC is 10...) "I have 20 attributes to manage in the bean).

    Then, I linked each attribute of the bean to the respective UIC property. You can see in this my thread (unfortunately without answers ) [ADF, JDev12.1.3] backingBean bean: a lot of properties to set for lots of CIU... is better by using the properties of the binding or access code (created by ID) UIC? a small example. I put the attributes the bean Builder (or in a function of 'action' if the APP properties must be set based on the interaction of the user).

    I would like to know:

    • If it is a good approach / recommended / safe or if there is a better way;
    • If the scope backingBean is OK, or if a larger scope would be better.

    As I asked in the thread in the link above, the situation can become difficult to manage if the PPP for which setting, properties are very different.

    So I'd like if there is no alternative that I can use to get the same result with less effort.

    For example, using the class ComponentReference or invokeOnComponentAPI could simplify my life? And their use could I always use backingBean brought beans?

    Thank you

    Federico

    Federico, please understand that this forum has no sla. I have other work to do, who pays my bills. I will do my best to help, but you can not expect the instant replay.

    (1) you must not use the bean to init your beans. You can delay load or init your beans instead.

    (2) as Frank and says you can use a bean to view range and use it to make your calculations as long as you know how their parameters go to the btf

    (3) you should always use the reference of the component if you bind a component to a bean. Make a habit of all scopes.

    As we do not know how you calculate the State and how often it changes while the Working Group is on the page, it is difficult to give further advice.

    Timo

  • The difficulty to define a page element by using $s

    Hi all

    I try to use an APEX 'list' as a "pick list", so that the user can click just a value in the value list on the right side of the page, and then refreshes the tabular presentation, query data for the selected value.

    I have a point to page setup to store the selected value and I can select an item in the list and I can see it changes the page element, but there's just the question for a second, and then the question is equivalent to null.

    Here is my sample application:

    Workspace: leppard

    username: guest

    PW: app_1000

    App: MyTestApp (App ID: 32581)

    Page: 27

    apex.Oracle.com/pls/apex/f?p=32581:27

    My dynamic action is named "Select a list item" and is based on a picker jQuery (li) and contains a simple code:

    $('li').click(function() {
        var text = $(this).text();
        $s('P27_LOC', text);
    });
    

    Then I have another real action to refresh the form of the tab area.

    I can't understand what I'm missing or why I see this behavior. Any advice or suggestions are appreciated!

    Thank you

    John

    I brought the following to your application changes to make it work:

    Change 1: as Scott suggests, your list of 'Place' under the shared components missing the href of the link. I changed your 'Location' as shown below.

    Before:

    select distinct null, loc label, null target from dept
    

    After:

    select distinct null, loc label, 'javascript:void(0);' target from dept
    

    Change 2: page 27, I edited your "Table" report Under the "Region definition-> Source-> Page elements must send", I entered the name of your item to display P27_LOC. This is because $s (JavaScript API) sets the value of the element on the page (DOM) and not in session state.

    3 change: page 27, I edited more your 'Table' report but this time to allow the partial-Page update. Report of the attributes-> layout and Pagination-> Enable partial Page Refresh. I've changed that from no to Yes. "Refresh" action under dynamic actions can refresh your report in the form only in a partial Page refresh was set to Yes.

    Thank you!

    JMcG

  • What defines the numbering of the pages on a bunch of files that are used in several Bookfiles?

    I have a bookfile FM 10 called BookfileA with 20 chapters. In Chapter 1, I put the chapter numbering starts at 1 and the numbering to start at 1. In chapters 2 to 20, I put the chapter numbering and numbering of pages to increment from the previous chapter. So far, so good, but here is the problem. .....

    In BookfileB, Chapter 1 is a different and original file Chapter 1 is transferred to Chapter 2. But the chapter of BookfileB 2 is still automatic reinstatement his chapter and the numbering of pages to 1.

    Unusually BookfileB has an additional chapter, do I have to monkey with the chapter numbering whenever I want to generate a Variant or another? Is there something numbering that I do not?

    Define the numbering and pagination of each file in the file of each book, not in individual files. Book settings take precedence over settings files.

    Refresh/update the books whenever you print, as not sure what common files update last book.

  • JS function as a type of page in QML property

    Hi all

    I'm trying to create useful js 'class' for my blackberry application and save here some information about qml object here is the example of such file js:

    /* * my js */
    
    function Utils(devInfo){ this.devInfo = devInfo; this.text = "test text";
    
     this.getInfo = function(){ return this.text; };}
    

    I want to group some utils functions here and use this js in qml file object, but I don't want to create "Utils" every time, I would like to have a single instance of page qml. I tried to use properties:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    import "myscripts.js" as Scripts
    
    Page {
        property variant utils : new Scripts.Utils(deviceInfo)
    
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onTouch: {
                var newLabeltext = utils.getInfo(); // freezing
                myLabel.text = newLabeltext;
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    * DevInfo is registered object c ++

    I got the following in the notecard event error message:

    "asset:///main.qml:15: TypeError: result of expression 'utils.getInfo' [[object Object]] is not a function."

    If I do not use the property and only with variable work, everything is ok. The following code works correctly:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    import "myscripts.js" as Scripts
    
    Page {
        //property variant utils : new Scripts.Utils(deviceInfo)
    
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onTouch: {
                var utils = new Scripts.Utils(deviceInfo);
    
                var newLabeltext = utils.getInfo();
                myLabel.text = newLabeltext;
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    In general, I don't know where I can store object js in qml page to access my functions utils without need to create each time. Any ideas?

    I think I found the answer

    According to this link, there is no global js object and every instance of component QML has own unique copy resources imported from JS:

    ...

    Code-Behind implementation resources

    Most of the JavaScript files imported into a document QML are implementations with State of the QML importation document. In these cases, each instance of the QML object type defined in the document requires a separate copy of the JavaScript and State objects to behave properly.

    The default behavior when importing the JavaScript files must provide a unique and isolated copy for each instance of the QML component. If this JavaScript file any resources or modules with a statement .import, its code will be executed in the same scope as the instance of the QML component and therefore can access and manipulate objects and properties declared in the QML component. Otherwise, it will have its own unique scope, and the objects and properties of the QML component should be passed to the JavaScript file as parameters functions if they are required.

    ...

    http://Qt-project.org/doc/Qt-5/qtqml-JavaScript-resources.html

    So it seems there is no need to implement the model of sigleton or store JS resources in the QML document. I changed my code as follows:

    /**
     * js
     */
    var utils = {
      devInfo : null
    };
    
    function init(deviceInfo){
      utils.devInfo = deviceInfo;
    };
    
    function getText(){
      return utils.devInfo + " done.";
    };
    

    and qml:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    
    import "myscripts.js" as Scripts
    
    Page {
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onCreationCompleted: {
                Scripts.init(deviceInfo);
            }
    
            onTouch: {
                myLabel.text = Scripts.getText("Tra-ta-ta");
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    It works fine - I can store information in the variable 'utils' and work with qml js objects. Hope so, it will help someone

Maybe you are looking for