SettingsActionItem and NavigationPane
I'm trying to reproduce BB10 settings menu in one of my apps. I want to push pages of navigation in the list settings screen. I used the cascadescookbook as my model for this feature. Everything works great and I can see my list of settings with the list of location settings option, but when I select the element, it never pushes the LocationSettings.qml page.
Here are the excerpts from main.qml.
NavigationPane { id: navPane // Define the Page and Sheet objects that would be used from the Application menu attachedObjects: [ ComponentDefinition { id: settingsPage source: "SettingsPage.qml" }, Sheet { id: infoSheet // The following page refers to the InfoPage.qml InfoPage { id: infoPage // Handle the custom signal from InfoPage.qml onDone: { infoSheet.close(); } } } ] // attachedObjects Menu.definition: MenuDefinition { id: menu actions: [ ActionItem { title: "Info" imageSource: "icons/info.png" onTriggered: { // For InfoPage, we will use Sheet infoSheet.open(); } } ] settingsAction: SettingsActionItem { imageSource: "icons/settings.png" onTriggered: { // For Settings, we will use NavigationPane var settingsPageObj = settingsPage.createObject(); Application.menuEnabled = false; navPane.push(settingsPageObj); } } } // MenuDefinition Page { -- container stuff -- } onPopTransitionEnded: { Application.menuEnabled = true; } }
The SettingsPage.qml
import bb.cascades 1.0 Page { id: settingsPage titleBar: TitleBar { title: "Settings" } Container { layout: DockLayout { } Container { topPadding: 15 bottomPadding: topPadding ListView { dataModel: XmlDataModel { source: "models/settingsmodel.xml" } listItemComponents: [ ListItemComponent { type: "settingsitem" // Use a predefined StandardListItem to represent "listItem" // items StandardListItem { title: ListItemData.title description: ListItemData.subtitle imageSource: ListItemData.imagesource } } // end of second ListItemComponent ] onTriggered: { // When an item is selected, we push the recipe Page in the chosenItem file attribute. var chosenItem = dataModel.data(indexPath); // Set the correct file source on the ComponentDefinition, create the Page, and set its title. settingsItemPage.source = chosenItem.file; var page = settingsItemPage.createObject(); page.title = chosenItem.title; // Push the new Page. navPane.push(page); } } } } attachedObjects: [ ComponentDefinition { id: settingsItemPage source: "LocationSettings.qml" } ] }
The settingsmodel.xml
and the LocationSettings.qml
import bb.cascades 1.0 Page { titleBar: TitleBar { } Container { Slider { value: 10.0 fromValue: 5.0 toValue: 200.0 } } }
In your SettingsPage.qml file... Comment the page.title = chosenItem.title; line and try again...
onTriggered: { // When an item is selected, we push the recipe Page in the chosenItem file attribute. var chosenItem = dataModel.data(indexPath); // Set the correct file source on the ComponentDefinition, create the Page, and set its title. settingsItemPage.source = chosenItem.file; var page = settingsItemPage.createObject(); // page.title = chosenItem.title; <------------------------ // Push the new Page. navPane.push(page); }
Tags: BlackBerry Developers
Similar Questions
-
Screen Navigation using the key and NavigationPane
Hey all, I've set up the navigation pane and I can switch between screens conveniently. On one page, however, I like to have buttons that snap into the screens. I do this by using NavigationPane.deprecatedPushQmlByString ("testPage.qml"), but this causes the push page to not have a navigation pane, only a back button. Why pushing by the navigationPane compared to a button causes the navigationPane on screens pushed not to present what would be the best way to address this problem? I wll continue to search for a solution, but any thoughts would be appreciated. Thank you.
understand now.
-
OAuth2: Refreshing token before application starts
Hi guys!
I desperately need help at the moment. I recently changed my app to use OAuth2, but it gives me an access token that I have to update every hour. The problem is that at the start of my application, I need to call the http API to refresh the token BEFORE any other API calls occur. I tried so many different ways to do this, but I can't get it quite right.
I tried to use QEventLoop which is what I found online as a way to QNetworkManager requires synchronous (because it is asynchronous by nature). First of all I tried to do this before creating the QML file...
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
But then when I leave the QEventLoop, would not continue on with the rest of the code, I guess because the loop main event starts everything after this line in order to create the QML is called. If entering a QEventThread separated until the thread main event started, I can't to get the refund.
So I tried to do it just after the creation of the QML file via this line above. However, it also doesn't seem to work well because sometimes if the QNetworkReply takes a long time to come back, the QML files already have intiialized and began some other API calls to retrieve the data, without having a valid token to send all they come back as http requests failed them.
Does anyone know a good way to go about this? I need to present this Http request to update my authentication token BEFORE anything else happens, especially before all other calls API occur because otherwise they won't be valid...
Thank you!!
T
Paratheo wrote:
I tried using the delegate class to load the tabs as they are needed, but I ran into issues because originally each tab, I have a NavigationPane. ....
-----
I do the same thing without a problem. See here my Concept of Navigation using TabbedPane as root and NavigationPanes on the top tabs:
Paratheo wrote:
.... The property delegated request a qml source file must have a Page to its root element. I could find a way to maintain my navigationpanes while using the delegate class to dynamically load my tabs. You know a way around this?
You can do this by using delegates - see the code here. (scroll down to "create dynamics and destroy")
-
By the RichShowDetailItem program add to Panel accordion JDveloper 11g
I would create dynamic menu with accordion and NavigationPane. I started with a simple page
-< f: view beforePhase = "#{appMenu.createMenu}" >
- ..........
-af:panelSplitter = "255" splitterPosition >
-< f: facet name = "first" >
-af:panelAccordion binding = "#{appMenu.menuPA}" >
-af:showDetailItem = text "showDetailItem 1" / >
-< / af:panelAccordion >
-< / f: facet >
I managed summer "#{appMenu} on the class with the createMenu function.
-{} public void createMenu (PhaseEvent phaseEvent)
-If (phaseEvent.getPhaseId () .equals (PhaseId.RENDER_RESPONSE)) {}
-menuPA.getChildren (.clear ());
-RichShowDetailItem dti1 = new RichShowDetailItem();
-dti1.setText ("Menu1");
-dti1.setDisabled (false);
-dti1.setClientComponent (true);
-dti1.setId ("menu1");
-B1 RichCommandButton = new RichCommandButton();
-b1.setText ("Test");
-dti1.getChildren () .add (b1);
-menuPA.getChildren () .add (dti1);
-... / / add next RichShowDetailItem (2 and 3)
- }
After posting accordion panel page has 3 points of detail but cannot open another technicality (when I click there no reaction).
I have the same problem with the dialog box created programmatically with the effective date, the calendar is displayed after clicking.
What I've done wrong?
Help, please
Rafal SmolarekHi Rafal,
For different reasons, the most important of them being the tree of components is not loaded before return when demand isn't a post (postback).
Kind regards
~ Simon
-
TabbedPane NavigationPane and return
Hi all
I am currently working on an application that has a TabbedPane as root control, one of the tabs has a grid of buttons which, once clicked will be display a NavigationPanel which will allow the user to scroll through the different pages.
The problem I have is how to return to the TabbedPane, once I'm done with the NavigationPane. Is the closest I have set up an action close in the action menu that displays the last page, then tries to restore the tabs panel display using the "Application::instance()-> setScene (root);", unfortunately, this causes app to freeze.
Ideally, I would go back to the TabbedPane using the default back button on the first page, but it seems to be disabled, adding that a custom button also fails IE does not appear.
So I was wondering if I'm missing something, IE the TabbedPane need to recreate?
Thanks for any help, how to integrate the different controls seems a little light on documentation.
Thanks and greetings
James
You don't need to return the pane tabs - use the following structure:
TabbedPane { Tab { id: tab1 title: "First Tab" NavigationPane { id: nav1 Page { id: page1 /* put your buttons here */ } onPopTransitionEnded: { page.destroy(); } } } Tab { id: tab2 } }
The structure above would output a blank page in your first tab. There will be no back along the action bar button, and the action bar itself will be invisible unless you put some ActionItems in there. Put your buttons on this first page (put it in a separate QML file so that your main.qml is sharper).
When you press a button on your home page (page1), pushing an extra page for 'nav1' it will be pushed ontop of page1 - and you'll get a back button this time. You have no need to do something to get back to the basic page, except by pressing the back button. When the top of the page gets jumped, you will automatically return to the base of the base. Be sure to destroy the pages you create in the onPopTransitionEnded handler.
-
NavigationPane and deprecatedPushQmlByString issues
I have a few beginner questions:
I explore the NavigationPane in QML component and the recommended method to push pages is "deprecatedPushQmlByString()". But the API documentation says, that this method is temporary and will be replaced. What to use instead?
And a second question: when I use this method, how do I access the push page from inside the NavigationPane (which is the parent component), for example to set a property of the page push? Can I set the pages inside the navigationPane instead to get a reference to each page one and then push them when necessary?
Look at the navigationpane documentation a bit more far, he explains how you can use attachedobjects with an example.
-
NavigationPane property and objectname explanation
Hi all!
I worked with a variety of examples of applications that use objects NavigationPane (in QML) and have noticed that sometimes the pages and/or lists that are in the NavigationPane resemble properties of the component:
NavigationPane {}
ID: navigationPane
firstPage: {Page}
ID: pgMain
content: {Of container
{To ListView
ID: listView
set the name of the object to leave listView to be detectable from C++
objectName: "listView".
layout: {GridListLayout}
...
Then, at other times, the words I in bold are simply not there. This makes a difference or have a meaning? Also, when and why do you use ' objectName. I looked through the documentation on both of these topics and not found many explanations.
objectName can also be used in QML, for example, when a child iteration of a container to distinguish them.
firstPage and content are the default properties. If the property name is omitted, the children of the element will be bound to a property by default (if there is a sense). More information on this:
http://Qt-project.org/doc/Qt-4.8/PropertyBinding.html#default-properties
Or better yet the example of Qt 5 documentation (it still applies to 4.8):
http://Qt-project.org/doc/Qt-5.0/qtqml/qtqml-syntax-objectAttributes.html#default-properties
-
NavigationPane second push freezes and blocks the application
I use a navigation pane to view a list of some points. So, if I type an item in the list, it grows perfectly to another page. Burst of this page also works.
When I try to type another item, the application hangs and crashes.
This is the output of the console when the application crashes:
18223290 (EventApp) process ended the SIGSEGV = 1 fltno = 11 ip=786dd9b0(/base/usr/lib/libbbcascades.so.1@+0x22058 code) mapaddr = 000dd9b0. REF = 00000010
Instead of using the deprecatedPushByQmlString(), I followed how to use objects.
Someone at - it any ideas what I am doing wrong?
There is apparently a mistake with this right now, deprecatedPushByString works well. Try that and also you have your "back" button the value of pop or the popAndDelete()?
Here is the link to the issue, it has been discussed quite well.
http://supportforums.BlackBerry.com/T5/Cascades-development/NavigationPane-malfunction/TD-p/1827025
Good luck.
-
SettingsActionItem / NavigationPane in TabbedPane initialization
I'm having a problem to SettingsActionItem to work properly with dynamic creation of NavigationPanes located in a TabbedPane.
The problem is that when I run the app, I create the first NavigationPane tab to the onCreationCompleted signal. If I then try to access the SettingsActionItem, I can't push more pages on the settings page.
If I select another tab, I can push more pages on the settings page, even when I return to the first who would work the first time. There must be something with the initialization of the first NavigationPane.
import bb.cascades 1.0 // Include asset folders import "folder1" import "folder2" import "folder3" TabbedPane { id: tabbedPane showTabsOnActionBar: false // Set to first tab id property NavigationPane currentNavigationPane: oneNavPaneObject property OneNavPane oneNavPaneObject property TwoNavPane twoNavPaneObject property ThreeNavPane threeNavPaneObject // Attached Objects attachedObjects: [ ComponentDefinition { id: settingsListPage source: "SettingsListPage.qml" }, Sheet{ id: infoSheet InfoPage { id: infoPage onDone: { infoSheet.close(); } } }, ComponentDefinition { id: oneNavPaneDefinition OneNavPane { } }, ComponentDefinition { id: twoNavPaneDefinition TwoNavPane { } }, ComponentDefinition { id: threeNavPaneDefinition ThreeNavPane { } } ] // Application Menu Menu.definition: MenuDefinition { id: menu actions: [ ActionItem { title: "Info" imageSource: "icons/info.png" onTriggered: { // For InfoPage, we will use Sheet infoSheet.open(); } } ] settingsAction: SettingsActionItem { imageSource: "icons/settings.png" onTriggered: { // For Settings, we will use NavigationPane var settingsListPageObj = settingsListPage.createObject(); Application.menuEnabled = false; currentNavigationPane.push(settingsListPageObj); } } } // Tabs Tab { id: oneTab title: qsTr("One") imageSource: "icons/one.png" onTriggered: { oneNavPaneObject = oneNavPaneDefinition.createObject() currentNavigationPane = oneNavPaneObject oneTab.content = oneNavPaneObject } } Tab { id: twoTab title: qsTr("Two") imageSource: "icons/two.png" onTriggered: { twoNavPaneObject = twoNavPaneDefinition.createObject() currentNavigationPane = twoNavPaneObject twoTab.content = twoNavPaneObject } } Tab { id: threeTab title: qsTr("Three") imageSource: "icons/three.png" onTriggered: { threeNavPaneObject = threeNavPaneDefinition.createObject() currentNavigationPane = threeNavPaneObject threeTab.content = threeNavPaneObject } } onCreationCompleted: { oneNavPaneObject = oneNavPaneDefinition.createObject() currentNavigationPane = oneNavPaneObject oneTab.content = oneNavPaneObject } }
Solved: Solution was to define the active tab.
onCreationCompleted: { oneNavPaneObject = oneNavPaneDefinition.createObject() currentNavigationPane = oneNavPaneObject oneTab.content = oneNavPaneObject tabbedPane.activeTab = oneTab }
-
In the root of TabbedPane NavigationPane
Hi all
I have a TabbedPane and then a menu with a SettingsActionItem. When this settings button fires I want to push a page that contains the parameters to this subject, and then I can click back to return to tabs.
import bb.cascades 1.0 TabbedPane { Menu.definition: MenuDefinition { settingsAction: SettingsActionItem { onTriggered: { var page = setingsView.createObject(); navigationPane.push(page); } attachedObjects: ComponentDefinition { id: settingsView source: "SettingsView.qml" } } } Tab { tite: "Tab1" NavigationPane { id: navigationPane Page { //etc..... } } }}
However, the problem is that there is no navigation pane to push the new page. We cannot put a NavigationPane under the TabbedPane, but we can put it in a tab of a TabbedPane.
So, how can I go all by pushing a new page?
Thank you!
[UPDATED ABOVE CODE]
I got it work using files separated such as:
hand. QML
TabbedPane { id: newsPane Tab{ title: "" TabOne { } } Tab{ title: "" TabTwo { } } Tab{ title: "" TabThree { } } Tab{ title: "" TabFour { } } }
Then, he...
TabOne.qml, TabTwo.qml, TabThree.qml and TabFour.qml:
NavigationPane { Page { .... } }
And it has an a NavigationPane feel TabbedPane when I can push to a page within the NavigationPane and action bar has more tabs, rather it changes the back button. Can be illustrated in this app: http://appworld.blackberry.com/webstore/content/20197455/?lang=en (I wrote the application for OnlineTobago)
So as much as your page 'Settings', why not use a spreadsheet? This is exactly what a spreadsheet is intended, something that breaks the normal flow of navigation. And it can be accessed via the system menu of any tab, if defined in the main.qml and using the property alias you can control the id defined in TabOne.qml, TabTwo.qml, etc. I have a sample where I do it too: http://bbcascades.com/index.php/tutorial-list/50-persistence-of-cascades-memory
I hope this helps.
-
Beta 3: call the application menu NavigationPane
Now we can define menus of applications of Cascades in Beta 3, I tried to find how we can call all windows in a SettingsActionItem.
I have a pane with tabs with a declared MenuDefination. I want to call a QML file that is a NavigationPane that contains the list of parameters. I have tried to seem so all documentation and sample applications and do not see the right way to do this. It would be nice to have a applications examples with an application menu that calls a settings screen.
Can anyone help or recommend best practices for this?
Thanks in advance.
Ok. I managed to do the work.
hand. QML
import bb.cascades 1.0 TabbedPane { showTabsOnActionBar: true Menu.definition: MenuDefinition { helpAction: HelpActionItem { imageSource: "asset:///icons/help.png" } settingsAction: SettingsActionItem { imageSource: "asset:///icons/setting.png" onTriggered : { settingsSheet.open() } } actions: [ ActionItem { title: "Info" imageSource: "asset:///icons/info.png" } ] } attachedObjects: [ Sheet { id: settingsSheet objectName: "settingsSheet" content: SettingsSheet { id: settingsContent } } ] Tab { title: qsTr("Tab 1") Page { id: tab1 Container { Label { text: qsTr("Tab 1 title") } } } } Tab { title: qsTr("Tab 2") Page { id: tab2 Container { Label { text: qsTr("Tab 2 title") } } } } Tab { title: qsTr("Tab 3") Page { id: tab3 Container { Label { text: qsTr("Tab 3 title") } } } } onCreationCompleted: { OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All; } }
SettingsSheet.qml
import bb.cascades 1.0 NavigationPane { Page { Container { Label { text: "Settings Page" } } } }
-
SettingsActionItem in a TabbedPane
Hey guys,.
I use the standard weatherguesser example TabbedPane. I'm trying to get a follow-up measure to push a page, but since it's a TabbedPane, pages cannot be pushed. However, I know that it is possible that the Google Talk application does it somehow. I was wondering if someone could help point me in the right direction here.
Here is an excerpt of the relevant code:
TabbedPane { id: mainTab showTabsOnActionBar: true // The home weather page that the user can select which city that they want to show // here by long pressing a city in the list and setting it as home. Tab { title: "Home" imageSource: "asset:///images/menuicons/icon_home.png" HomePage { id: homeCityPage // The data model and the city property of the home weather is kept in the // _homeModel which is created and bound in C++. weatherData: _homeModel; city: _homeModel.city; } } attachedObjects: [ ComponentDefinition { id: moreInfoPageDefinition source: "MoreInfoPage.qml" }, ] Menu.definition: MenuDefinition { // Add a Help action helpAction: HelpActionItem { } // Add a Settings action settingsAction: SettingsActionItem { onTriggered: { var moreInfoPage = moreInfoPageDefinition.createObject(); mainTab.push(moreInfoPage); } } } }// TabbedPane
You don't actually push the page in the TabbedPane, but make the Page you decide to display in a given tab be a NavigationPane rather than a mere Page, and then you can do the things usual push(), at least on this tab.
If you have multiple tabs and don't like the idea of making each one a NavigationPane, perhaps you need to change the approach so that each fact tab refers to a single NavigationPane, and when you change the active tab it does not actually change the activePane. The way to do this is documented in the docs of TabbedPane. It is not very difficult, but not I would call it trivial.
-
Tabs and action items as in the hub
Hi guys,.
I'm trying to get a TabbedPane working with action on bar points and overflow as you can see in the hub, but I can't get the two working together. If I use a TabbedPane followed do not appear on bar or overflow. If I use a NavigationPane action items work, but I can't use the tabs...
This is an image I found in the native BlackBerry documentation. Here, you see the button on the tab on the left, three elements of action on bar and the overflow action items opener.
Can someone please give me a hint or example?
Kind regards
Jan
You must add the ActionItem to the Page, as follows:
import "Webview" import "Account" TabbedPane { tabs: [ Tab { title: qsTr("A Tab") Page { Label { text: "Hello World" } actions: [ ActionItem { ActionBar.placement: ActionBarPlacement.OnBar title: "An action item" } ] } } ] }
-
How to connect the ButtonClick events to NavigationPane.popAndDelete within QML
Hi all
I know to connect my click event of the button to NavigationPane.popanddelete in the native SDK,
I want to implement this feature in QML, how to implement it.
My struct QML is something like this:
P
MyHeader.QML Container{ Button{ objectName:"BackButton" onClicked:..//how to write here } } MyPage.QML Container{ MyHeader{ } Container{ } } within C++ QmlDocument *qml = QmlDocument::create("MyPage.qml"); AbstractPane *mypage= qml->createRootNode
(); // Button *button = alertPage->findChild Thanks in advance...
Hello
I want everything first, make sure that you know about the properties of the component in QML. If you have inserted a page in your navigation pane and want to have a back button seems natural, you can use the following code in your definition of QML Page {}:
paneProperties: {NavigationPaneProperties}
ButtonBack: {ActionItem}
Title: 'Back '.
onTriggered: {}
_navPane.pop ();
}
}
}This will insert a lower bar filled with a previous button following a consistent style.
If you want to raise the pop event from the QML document via manual button (no), in the property of your onClicked button, you can simply call pop on the handle of your navigation pane.
for example
Button {}
ID: buttonTest
objectName: "buttonTest.
text: "text".
onClicked: {}
_navPane.pop ();
}Please note that in both cases, you have exposed the handle of "_navPane" in your C++ code with subsequent calls (assuming that m_SidePaneContentQML is the name of your page with the back button):
m_SidePaneContentQML = QmlDocument::create().load("SidePane/SidePane.qml");
m_SidePaneQmlContext = m_SidePaneContentQML-> documentContext();
m_SidePaneQmlContext-> setContextProperty ("_navPane", m_Nav);In this case, m_Nav would be the navigation pane that you use.
Let me know if you need more information, I'm happy to help you.
Good luck!
Martin
-
onPeekStarted and onPeekEnded signals not firing
Here's a simple QML which shows that the onPeekStarted and onPeekEneded signals not shooting. What I am doing wrong?
NavigationPane { id: navigationPane Page { Container { Button { id: button text: "Navigate" onClicked: { var page = pageDef.createObject(); navigationPane.push(page); } } } } attachedObjects: [ ComponentDefinition { id: pageDef Page { id: secondPage Label { text: "Second page" } paneProperties: NavigationPaneProperties { backButton: ActionItem { title: "First page" imageSource: "back.png" onTriggered: { navigationPane.pop(); } } } } } ] onPopTransitionEnded: { page.destroy(); button.text = "Page destroyed" } onPeekStarted: { button.text = "peek started"; } onPeekEnded: { button.text = "Peek ended"; } }
Reading the documentation, the onPeekStarted and onPeekEneded signals are sent to the Page and not the NavigationPane. It makes sense that the Page is the component that is to be read on.
NavigationPane { id: navigationPane Page { onPeekStarted: { button.text = "Peek started"; } onPeekEnded: { button.text = "Peek Ended"; } Container { Button { id: button text: "Navigate" onClicked: { var page = pageDef.createObject(); navigationPane.push(page); } } } } attachedObjects: [ ComponentDefinition { id: pageDef Page { id: secondPage Label { text: "Second page" } paneProperties: NavigationPaneProperties { backButton: ActionItem { title: "First page" imageSource: "back.png" onTriggered: { navigationPane.pop(); } } } } } ] onPopTransitionEnded: { page.destroy(); button.text = "Page destroyed" } }
Maybe you are looking for
-
Video cable LCD BLI for Toshiba Satellite S50t-B
Hello We have laptop Toshiba Satellite S50t-B, what LCD video cable will fit this laptop? the cable was written on it the following:BLI LCD CABLEDD0BLILC020140409 JHIREV:3 HAS(you can take a look at the photos too). Please let me know if the two vers
-
Why he closed my tab and opens in another window. It bothers me a lot.
Why it closes my tab and opens it in other window. It to me very much disturbs. I touch nothing. It occurs on 20 times a day. This has happened Each time Firefox opened Is in May.
-
New MacBook 12 "power on problem
Hi, yesterday I turned on the power on my MacBook. The White Bar under slept for about 20 minutes at the end of race and no logo is not moved from there. So I Pushed power button 10 seconds to turn off. After that, no life! Tried everything. Reset th
-
What is the best way to repeat a subset of instructions box a fixed number of times
I have a state machine with a structure of enclosure containing about 30 cases. Whenever the case #20 is called, what is the best way to repeat the case #20 throught #25 within the affair 10-fold structure before moving to another record number?
-
NET Framework in XP SP 2 installation problem
NET Framework installation (any) in XP Media Center Edition 2005SP 2 I get the message Windows found something wrong with this file and then install closes unexpectedly.