-1

This is my first post on this forum , just started the BB 10 development and also C ++ as I am a Java Person. I am having some problem in QML and C++ intergration

Here what I am trying to do:

I have login page , on login button click my new page (which is a navigation pane ) gets open without any issue here is the method I use

void Integration:penNextPage() {
    printLog("-- open second page (a navigation pane ");
    new SecondPageHndlr (appRefrence);
}

Here is what I am doing in SecondPageHndlr class :

SecondPageHndlr.cpp
#include "SecondPageHndlr.hpp"
#include "ThirdPageHndlr.hpp"
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/NavigationPane>
#include <bb/cascades/Page>
#include <bb/cascades/Sheet>
#include <QObject>
#include <QIODevice>
#include <iostream.h>
#include <string.h>
#include <stdio.h>
using namespace bb::cascades;
SecondPageHndlr::SecondPageHndlr(bb::cascades::Application *app)
: QObject(app){
    try{
            QmlDocument *secondQml = QmlDocument::create("asset:///SecondPage.qml");
            if (!secondQml->hasErrors()) {
                NavigationPane* page = secondQml->createRootObject<NavigationPane>();
                if (page)
                {
                    printLog("second page view . page is not  null ");
                    //make this c++ file accessable from the dashboardviewn.qml
                    pane = page;
                    secondQml->setContextProperty("second", this );
                    app->setScene(page);
                }
                else
                    printLog("page is null ");
            }
            else
                printLog("Error in second page view QML");
        }
        catch (std::exception& e)
        {
            printLog("-------- Exception");
            std::cout << "Exception: " << e.what();
        }
}
void SecondPageHndlr::showThirdScreen(){
    printLog("-- open Third page (a navigation pane pushes a new page");
    new ThirdPageHndlr (pane);
}
void SecondPageHndlr::printLog(const char *str){
    cout <<"\n" << str ;
    printf("" ,1);
    fflush(stdout);
}

Now when from this second screen I try to open the third page it would not work at all kindly see the code and tell me what em doing wrong

cmannett85
  • 21,725
  • 8
  • 76
  • 119
Shivang
  • 935
  • 8
  • 18
  • 1
    If your problem is about qml integration, You should show your qml code. Btw, i'd recommend to log with qDebug()<<"your log "; – Benoit Jun 18 '13 at 21:49

1 Answers1

0

You are already using navigation pane then there is no issue with opening any other pages. See the following qml code

import bb.cascades 1.0

NavigationPane {
    id: navigationPane
    Page {
        // page with a picture thumbnail
        Container {
            background: Color.Gray
            layout: DockLayout {
            }
            Button {
                horizontalAlignment: HorizontalAlignment.Center
                verticalAlignment: VerticalAlignment.Center
                text: qsTr("Show detail")
                onClicked: {
                    // show detail page when the button is clicked
                    var page = secondPageDefinition.createObject();
                    console.debug("pushing detail " + page)
                    navigationPane.push(page);
                }
                  attachedObjects: [
                    ComponentDefinition {
                        id: secondPageDefinition
                        source: "DetailsPage.qml"
                    }
                ]
            }
        }
    }

}

DetailsPage.qml

Page{
  Label{
text: qsTr("Second Page")
}

}

pranavjayadev
  • 937
  • 7
  • 31