1

i have used NavigationPane in Sign.qml page,After user Logins it will go to Homescreen.qml in Homescreen.qml i have used TabbedPane, while clicking the Login button (Signin.qml)i am getting response,but can't able to go to Homescreen.qml

hereby i have attached my code Signin.qml

    NavigationPane {
              id: navigationPane
          Page {

    attachedObjects: ComponentDefinition {
        id: pageDefinition
        source: "HomeScreen.qml"
    }
    Container {
        Button {
            text: "Login"
            onClicked: {
                //check if is credentials are valid or not
                if(isValidUser())
                {
                    var page = pageDefinition.createObject();
                    navigationPane.push(page);
                }
                else
                {
                    //show error message
                }
            }
        }
    }
}}

and my Homescreen.qml code

       import bb.cascades 1.0

           TabbedPane {
             id: mainTab
             showTabsOnActionBar: true 

Tab {
       title: "Home"
       imageSource: "asset:///menuicons/home.png"

        Signin {
           id: signin
       }
   }
Tab {
    title: "Home"
    imageSource: "asset:///menuicons/home.png"

     Editnew {
        id: homepage
    }
}
Tab {
    title: "Messages"

    Messages {

    }
}

Tab {
    title: "Search"

    Search{

    }
}
Tab {
    title: "Feeds"

    Feeds {

    }
}

Tab {
    title: "Nearby"

    Nearby{

    }
}
Tab {
    title: "Followers"

    Followers {
        id: foll
    }
}
Tab {
    title: "Group"

    Groups {
        id: groups
    }
}

i cant able to view Homescreen.qml while clicking login button from sign-in,can anyone give me some idea how to do this..?

itsaboutcode
  • 24,525
  • 45
  • 110
  • 156
Vendetta
  • 513
  • 2
  • 16

2 Answers2

3

You can not push a TabbedPane inside a NavigationPane. It's best practice to use TabbedPane at top of application flow and if you want to go deeper, you can use NavigationPane inside a TabbedPane.

Still there's a workaround for you. You can put your TabbedPane inside a sheet and open that sheet rather than pushing in on NavigationPane.

attachedObjects: Sheet {
            id: tabbedPaneSheet
            Homescreen{
            }
    }
...
onClicked{
    tabbedPaneSheet.open()
}
...
Nishant Shah
  • 1,590
  • 1
  • 15
  • 25
0

make a one more function like this and call this function on sign in....

void  xxxx::homescreen()
   {



        // create scene document from main.qml asset
        // set parent to created document to ensure it exists for the whole application lifetime
        QmlDocument *qml = QmlDocument::create("asset:///homescreen.qml").parent(this);

        qml->setContextProperty("_app", this);


        AbstractPane *root = qml->createRootObject<AbstractPane>();



        // set created root object as a scene


        app1->setScene(root);

    }
Baby Groot
  • 4,637
  • 39
  • 52
  • 71